On 11/17/2011 3:05 PM, Ivan Voras wrote:
Hello,

I'm having trouble using AES_cfb128_encrypt() - I've isolated it to the
simple example below. The problem is that the decryption doesn't work -
the output (in buf3) is binary gibberish.

         SHA256(key, key_size, enc_key);
         AES_set_encrypt_key(enc_key, 256,&aes_enc_key);
         AES_set_decrypt_key(enc_key, 256,&aes_dec_key);

         memcpy(buf1, str, str_size);
         dump_data(buf1, str_size, "1");

         num = 0;
         memset(iv, 0, 16);
         AES_cfb128_encrypt(buf1, buf2, str_size,&aes_enc_key, iv,&num,
AES_ENCRYPT);
         dump_data(buf2, str_size, "2");

         num = 0;
         memset(iv, 0, 16);
         AES_cfb128_encrypt(buf2, buf3, str_size,&aes_dec_key, iv,&num,
AES_DECRYPT);
Shouldn't this be AES_cfb128_decrypt() ?
         dump_data(buf3, str_size, "3");

It looks like there may be something I'm missing here... any ideas?

The whole test program is at http://goo.gl/k0QnL .


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to