/// <summary> /// Decrypts a base64 encoded string to its plaintext, using the specified passwords/IVs. /// </summary> /// <param name="pTextToDecrypt"></param> /// <param name="pPassPhrase"></param> /// <param name="pInitVector"></param> /// <returns></returns> public static string AESDecrypt(string pTextToDecrypt, string pPassPhrase, string pInitVector) { RijndaelEnhanced rijndaelKey = new RijndaelEnhanced(pPassPhrase, pInitVector); return(rijndaelKey.Decrypt(pTextToDecrypt)); }
/// <summary> /// AESs the decrypt. /// </summary> /// <param name="pTextToDecrypt">The text to decrypt</param> /// <param name="pPassPhrase">The pass phrase</param> /// <param name="pInitVector">The init vector</param> /// <param name="hashAlgorithm">The hashing algorithm to use</param> /// <returns></returns> public static string AESDecrypt(string pTextToDecrypt, string pPassPhrase, string pInitVector, AESHashAlgorithm hashAlgorithm) { RijndaelEnhanced rijndaelKey = new RijndaelEnhanced(pPassPhrase, pInitVector, 4, 0, 128, hashAlgorithm.ToString()); return(rijndaelKey.Decrypt(pTextToDecrypt)); }