Re: Pass DES encrypted data between Java and openssl

2006-12-06 Thread Marc Saegesser
Steve, Thanks for the help. I finally got this working and figured I'd reply here in case this might help others. I found a Java implementation of EVP_BytesToKey() in the JRuby code and borrowed it. I ran the password through it and the key and IV I got back didn't mach what openssl enc -d -de

Re: Pass DES encrypted data between Java and openssl

2006-12-05 Thread Marc Saegesser
Steve, Thanks for the help. I finally got this working and figured I'd reply here for posterity's sake. I found a Java implementation of EVP_BytesToKey() in the JRuby code and borrowed it. I ran the password through it and the key and IV I got back didn't mach what openssl enc -d -des -p showe

Re: Pass DES encrypted data between Java and openssl

2006-12-05 Thread Julius Davies
Whoops! This method only takes an InputStream on my LOCAL machine. :-$ PKCS8Key.decrypt( "DES", "CBC", dk, false, null, fin ); You'll need to replace that line with: byte[] bytes = Util.streamToBytes( fin ); PKCS8Key.decrypt( "DES", "CBC", dk, false, null, bytes ); yours, Julius On 12/5

Re: Pass DES encrypted data between Java and openssl

2006-12-05 Thread Julius Davies
Hi, Marc, If you download the "not-yet-commons-ssl.jar" I'm working on, you can decrypt your file with the Java code I've included below. I tested using Sun Java 1.4.2. Notice the password in the example: char[] pwd = "secret".toCharArray(); http://juliusdavies.ca/commons-ssl/download.html U

Re: Pass DES encrypted data between Java and openssl

2006-12-04 Thread Dr. Stephen Henson
On Mon, Dec 04, 2006, Marc Saegesser wrote: > I have an existing application (which I don't control) that sends me files > that were encrypted using an openssl comand like: > > openssl enc -e -des -pass pass: > > I would like to decrypt these files inside a Java application and generate > respon