Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Storing the Initialization Vector - Separate field?

When encryption sensitive information using the .NET AesCryptoServiceProvider library I generate a unique Initialization Vector (IV) for each value that is encrypted. In the database record where I save the encrypted data I have a field named "IV" which stores the Initialization Vector for use in later decryption.

Is there a different way in which the Initialization Vector can be stored alongside the cipher-text? By appending the IV to the Cipher Text perhaps? If so, is there a standard approach?

like image 355
webworm Avatar asked Mar 24 '16 21:03

webworm


1 Answers

Is there a different way in which the Initialization Vector can be stored alongside the cipher-text? By appending the IV to the Cipher Text perhaps?

Yes, you can do exactly that. Prepending it to the ciphertext works.

If so, is there a standard approach?

No, there is no standard. A common way is to prepend the IV. If you're applying the Cryptographic Message Standard (CMS), then there is a little bit about how the IV is stored. RFC3370

like image 135
Artjom B. Avatar answered Sep 18 '22 07:09

Artjom B.