Beispiel #1
0
        /// <summary>
        /// Encrypt the specified clearText using the specified base64 key. The result is
        /// a base64 string containing the encrypted text, a dollar sign ("$"), and finally
        /// the base64 initialization vector.
        /// </summary>
        /// <returns>The encrypted text and initialization-vector.</returns>
        /// <param name="clearText">The string to encrypt.</param>
        /// <param name="b64Key">The base64 key to use with the symmetric algorithm.</param>
        public static string EncryptText(string clearText, string b64Key)
        {
            Aes256 aes = new Aes256();

            return(aes.Encrypt(clearText, b64Key));
        }
Beispiel #2
0
        /// <summary>
        /// Decrypt the specified base64 cipher-text using the specified base64 key
        /// and initialization vector.
        /// </summary>
        /// <returns>The decrypted text string.</returns>
        /// <param name="b64CipherText">The base64 cipher-text to decrypt.</param>
        /// <param name="b64Iv">The base64 initialization vector.</param>
        /// <param name="b64Key">The base64 key.</param>
        public static string DecryptText(string b64CipherText, string b64Iv, string b64Key)
        {
            Aes256 aes = new Aes256();

            return(aes.Decrypt(b64CipherText, b64Iv, b64Key));
        }