Two AES implementations generated different encryption results

I have an application that uses an opensource "libgcrypt" to encrypt/decrypt a data block (32 bytes). Now I am going to use Microsoft CryptAPI to replace it. My problem is that the libgcrypt and CryptApi approaches generate different ciphertext contents as I use the same AES-256 algorithm in CFB mode, same key (32 bytes), and same IV (16 bytes), although the ciphertexts can be decrypted by their own correspndingly.

Could some one tell me what is the problem? Thanks.
yingchunliAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

pand0ra_usaCommented:
I believe this comes down to different implementations of the algorithm.  

NIST may have a more detailed explanation of why.

http://csrc.nist.gov/groups/STM/cmvp/documents/140-1/140val-all.htm
http://en.wikipedia.org/wiki/Advanced_Encryption_Standard

0
dwarner8Commented:
More than likely a cause of the random number generator to generate the seed key.
0
yingchunliAuthor Commented:
By using libgcrypt library, Cipher.InitilizeCipher( Key , KeySize , IV ) is used to init the cipher.
By CryptAPI, the same Key is imported to the CSP, by calling CryptImportKey() and pass the PLAINTEXTKEYBLOB object which holds the key (Key) data.   IV is set by calling CryptSetKeyParam(hKey, KP_IV, IV, 0).
This way, no random generator is used.
 
0
HappyCactusCommented:
Why don't you try some testvector? If the results are different, you can spot the failing library and, maybe, spot the error... http://csrc.nist.gov/groups/STM/cavp/documents/aes/KAT_AES.zip
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.