Created
March 22, 2011 06:35
-
-
Save murven/880858 to your computer and use it in GitHub Desktop.
This snippet generates a random 256-bit Key and IV to be used for encryption purposes using the AES algorithm. Better when used from LINQPad.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var aesAlgorithm = new System.Security.Cryptography.AesManaged(); | |
aesAlgorithm.GenerateIV(); | |
aesAlgorithm.GenerateKey(); | |
var key = aesAlgorithm.Key; | |
var iv = aesAlgorithm.IV; | |
Console.WriteLine(key.Length); | |
Console.WriteLine(key); | |
Console.WriteLine(iv.Length); | |
Console.WriteLine(iv); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment