Skip to content

Instantly share code, notes, and snippets.

@awswithdotnet
Created March 3, 2022 19:21
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
kms Crypto AESDecrypter Decrypt Partial 2
string plainText = String.Empty;
byte[] byteData = Convert.FromBase64String(encryptionPackage.CipherText);
using (Aes aes = Aes.Create())
{
using (MemoryStream memoryStream = new MemoryStream(byteData))
{
using (CryptoStream cryptoStream = new CryptoStream(memoryStream, aes.CreateDecryptor(key, _iv), CryptoStreamMode.Read))
{
using (StreamReader streamReader = new StreamReader(cryptoStream))
{
plainText = streamReader.ReadToEnd();
}
}
}
}
return plainText;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment