Created
September 19, 2020 17:13
-
-
Save ssukhpinder/738b4617ede24cef163de149c7fd24ba to your computer and use it in GitHub Desktop.
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
FileStream myStream = new FileStream("TestData.txt", FileMode.OpenOrCreate); | |
Aes aes = Aes.Create(); | |
byte[] key = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16 }; | |
byte[] iv = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16 }; | |
CryptoStream cryptStream = new CryptoStream( | |
myStream, | |
aes.CreateEncryptor(key, iv), | |
CryptoStreamMode.Write); | |
StreamWriter sWriter = new StreamWriter(cryptStream); | |
sWriter.WriteLine("Hello World!"); | |
sWriter.Close(); | |
cryptStream.Close(); | |
myStream.Close(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment