Re: Blowfish CBC output ciphertext differs in OpenSSL and Java with same key and IV

2008-04-29 Thread Vishal Rao
On Tue, Apr 29, 2008 at 5:03 AM, Dr. Stephen Henson [EMAIL PROTECTED] wrote: The call to EVP_EncryptInit_ex() uses the default key length for the cipher unless told otherwise. For Blowfish this is 128 bits but you have a 56 byte (?) key. You need to set the key length using

Re: Blowfish CBC output ciphertext differs in OpenSSL and Java with same key and IV

2008-04-28 Thread Julius Davies
I have no idea if your C++ code is correct, but I wrote some java code the correctly does that java side. Download not-yet-commons-ssl.jar and try this utility class: org.apache.commons.ssl.OpenSSL Here are the instructions to use it: http://juliusdavies.ca/commons-ssl/pbe.html In your case

Re: Blowfish CBC output ciphertext differs in OpenSSL and Java with same key and IV

2008-04-28 Thread Dr. Stephen Henson
On Mon, Apr 28, 2008, Vishal Rao wrote: C++ code using OpenSSL: unsigned char testplaintext[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; unsigned char ciphertext[100] = {0}; int outlen, tmplen; unsigned char key[56] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,

Blowfish CBC output ciphertext differs in OpenSSL and Java with same key and IV

2008-04-27 Thread Vishal Rao
Hello, I'm trying to encrypt a few bytes (as a trial run) with the same key and IV with Blowfish in CBC mode and standard PKCS padding using OpenSSL in a C++ app and also using SUN's Java crypto libraries. The output ciphertext is different in both places which means that I cannot get them to