Hello OpenSSL mail list,

I am trying to write a program to decrypt .odt documents using
OpenSSL. When testing the code I wrote, I can decrypt any of the test
strings I encrypt, but when I try to decrypt one of the encrypted
files from an .odt document it only spits out gibberish. Following the
specifications for .odt documents I do the following:

unsigned char* digest;
unsigned char* md = new unsigned char[DIGEST_SIZE]; //DIGEST_SIZE = 20

digest = SHA1(password, passwordSize, md); //password being an
unsigned char array, and passwordSize being a long int

//salt being and PBKDF2_key being unsigned char arrays of size 16,
ITERATION_COUNT being 1024, and SALT_SIZE and KEY_SIZE being 16.
if(md != 0)
  PKCS5_PBKDF2_HMAC_SHA1((char*)md, DIGEST_SIZE, salt, SALT_SIZE,
ITERATION_COUNT, KEY_SIZE, PBKDF2_key);
else
  PKCS5_PBKDF2_HMAC_SHA1((char*)digest, DIGEST_SIZE, salt, SALT_SIZE,
ITERATION_COUNT, KEY_SIZE, PBKDF2_key);

int num = 0;
BF_KEY key;
BF_set_key(&key, KEY_SIZE, PBKDF2_key);
//with in and out being unsigned char arrays of size length and iVec
being a unsigned char array of size 8.
// in being a buffer of encrypted data, and out being the destination
for the decrypted data
BF_cfb64_encrypt(in, out, length, &key, iVec, &num, BF_DECRYPT);


Can anybody see a problem with this code? When I use this to decrypt
an encrypted file from the .odt document, using the salt and
initialization vector from the manifest file (after un-base64ing them)
and all I get is garbage values. Thank you for your time and help.


P.S. I wrote my program using C++ and compiled under Slackware 12.1 if
it matters .
-- 
-John Young
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to