import org.apache.commons.io.IOUtils;
import org.apache.commons.ssl.OpenSSL;
import java.io.File;
import java.io.FileOutputStream;
public class Foo
{
public static void main(String[] args) throws Exception
{
File f = new File("/tmp/foo");
FileOutputStream fout = new FileOutputStream(f);
fout.write(OpenSSL.encrypt("aes256",
"secret".toCharArray(),
"hello world\n".getBytes("UTF-8")));
fout.close();
Process p = Runtime.getRuntime()
.exec("openssl enc -pass pass:secret -d -aes256 -a -in /tmp/foo");
System.out.print(IOUtils.toString(p.getInputStream()));
}
}