The standard API for encryption in
Java is called JCE; the
http://faq.javaranch.com/java/SecurityFaq#encryption contains a fair amount of information about it.
Why do you want to run a script as step 3? Can't you do that from within the application?
You'll need to think about where to store the encryption key (unless you want to hardcode that into the application code).