Example #1
0
 public static string DecryptThenMacWithAES(string key, string ciphertext)
 {
     return(Encoding.UTF8.GetString(DecryptThenMacWithAES(CryptManager.DecodeBase64ToBytes(key), CryptManager.DecodeBase64ToBytes(ciphertext), null)));
 }
Example #2
0
 /// <summary>
 /// Creates a Decryptor CryptoStream based on the AES 128 OFB algorithm.
 /// </summary>
 /// <param name="inputStream">The input stream.</param>
 /// <param name="key">The Key.</param>
 /// <param name="iv"></param>
 /// <returns>the Decryptor CryptoStream</returns>
 private static CryptoStream GetAES128DecryptorStream(Stream inputStream, string key, string iv)
 {
     // Pre: iv is a 16bytes base64 encoded string
     return(CryptManager.Instance.GetAES128DecryptorStream(inputStream, CryptManager.DecodeBase64ToBytes(key),
                                                           CryptManager.DecodeBase64ToBytes(iv)));
 }
Example #3
0
        public static string EncryptThenMacWithAES(string key, string plaintext)
        {
            string result = CryptManager.EncodeBase64(EncryptThenMacWithAES(CryptManager.DecodeBase64ToBytes(key), Encoding.UTF8.GetBytes(plaintext), null));

            return(result);
        }