Hi,
your problem is that you are decrypting with a different initialization vector than
the one you are encrypting with.
Before decryption, you must set the ivec to the same value it had before encryption.
The relevant parameter of des_ede3_cbc_encrypt() for this is "des_cblock *ivec".
Try for example this:
des_cblock ivec;
memset((void *)&ivec,0,8);
des_ede3_cbc_encrypt(...,(des_cblock *)&ivec,...)
for encryption AND decryption. Then it should work.
People smarter than me generally recommend however that you use a different value of
ivec for each pair of encryption/decryption operation (e.g. timestamp or something
random)- that's what it is there for: to make the result of different encryption
operations look different, even if the same plaintext is encrypted with the same keys.
Remember though that you will need the value for decryption.
Hope this helps,
Steve
[EMAIL PROTECTED] wrote:
> Hi,
>
> The first 8 bytes of my decrypted ciphertext are garbage. The rest is OK.
> I encrypt 12220 bytes in one pass with des_ede3_cbc_encrypt(...)
>
> Are the any prerequisites which are necessary for encrypting/decrypting with
> DES ?
>
> Thanks,
> Niels
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]