Thank you Julius Davies! for not-yet-commons-ssl which does exactly what I was looking for
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())); } }
Woo hoo!
3 writebacks [/src/java] permanent link
Anyone know of a combination of PBE[Something] in JCE which can work with -[something] in OpenSSL? I am annoyed at having to keep writing little java apps to decrypt stuff encrypted in java. Should be able to just use OpenSSL :-)
Help?