kms Crypto AESEncrypter Partial 2
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
using (Aes aes = Aes.Create()) | |
{ | |
ICryptoTransform cryptoTransform = aes.CreateEncryptor(plainTextKey, _iv); | |
using (MemoryStream memoryStream = new MemoryStream()) | |
{ | |
using (CryptoStream cryptoStream = new CryptoStream(memoryStream, cryptoTransform, CryptoStreamMode.Write)) | |
{ | |
using (StreamWriter streamWriter = new StreamWriter(cryptoStream)) | |
{ | |
await streamWriter.WriteAsync(plainText); | |
} | |
encryptedData = memoryStream.ToArray(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment