Esempio n. 1
0
        /// <summary>
        /// Decrypt data from base64 <see cref="string"/> to <see cref="string"/> using <see cref="Convert.FromBase64String(string)"/> and <see cref="Encoding"/>
        /// </summary>
        /// <param name="encryptor">Specific encryptor</param>
        /// <param name="encryptedData">Encrypted base64 data for decryption</param>
        /// <param name="encoding">Encoding for conversion to string</param>
        /// <returns>Decrypted string data</returns>
        public static string DecryptStringFromBase64String(this IEncryptor encryptor, string encryptedData, Encoding encoding)
        {
            encoding.NullValidate(nameof(encoding));

            var decryptedByteData = encryptor.DecryptFromBase64String(encryptedData);

            return(encoding.GetString(decryptedByteData));
        }