Generating unique ciphertexts from same cleartext

Topics: Cryptography Application Block
Apr 11, 2011 at 1:49 PM

I've been using the Enterprise Library for a little while now and I really like the way it wraps and simplifies the Cryptography namespace.
There's something I've been wondering about though:
I've been using RijndaelManaged and If you give it the same cleartext multiple times, it still generates unique ciphertexts for them.
I thought you had to constantly change the IV value to get that kind of behavior. But the library doesn't expose IV at all.
How is it doing it(?!)

Thanks!

Apr 12, 2011 at 12:43 AM

The block creates a new instance of the symmetric algorithm everytime you perform encryption/decryption thus, always making use of a different IV.

 

Sarah Urmeneta
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

Apr 12, 2011 at 1:54 AM
Edited Apr 12, 2011 at 1:56 AM

So if the IV is different for every instance of use, how is it ever able to decrypt something back?

 I mean, you gotta have the same key and IV to get something back right?

Apr 12, 2011 at 2:04 AM

It extracts the IV from the encrypted text.  You can see the logic in the ExtractIV method of the SymmetricCryptographer class which is called inside its Decrypt method. 

 

Sarah Urmeneta
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com