Exemple #1
0
 public static string DecryptWithAES256(KeyData key, string cipherText)
 {
     try {
         return(Decrypt(cipherText, s => GetAES256DecryptorStream(s, key)));
     } catch (Exception) {
         throw new InvalidOperationException("Cannot decrypt the content");
     }
 }
Exemple #2
0
 /// <summary>
 /// Creates a Decryptor CryptoStream based on the AES 256 CBC algorithm.
 /// </summary>
 /// <param name="inputStream">The input stream.</param>
 /// <param name="key">The Key.</param>
 /// <returns>the Decryptor CryptoStream</returns>
 /// <author>dfs</author>
 /// <datetime>18-01-2013-10:46</datetime>
 private static CryptoStream GetAES256DecryptorStream(Stream inputStream, KeyData key)
 {
     return(CryptManager.Instance.GetAES256DecryptorStream(inputStream, key.KeyBytes, key.IVBytes));
 }
Exemple #3
0
 public static string EncryptWithAES256(KeyData key, string content)
 {
     return(Encrypt(content, s => GetAES256EncryptorStream(s, key)));
 }