I'm using VB.Net's RijndaelManaged
(RM) to encrypt files, using the RM.GenerateKey
and RM.GenerateIV
methods to generate the Key and IV and encrypting the file using the CryptoStream
class. I'm planning on saving this Key and IV to a file and want to make sure I'm doing it the right way. I am combining the IV+Key, and encrypting that with my RSA Public key and writing it out to a file. Then, to decrypt I use the RSA Private key on this file to get the IV+Key, split them up and set RM.Key and RM.IV to these values and run the decryptor.
Is this the best method to accomplish this, or is there a preferred method for saving the IV & Key?