/// <summary> /// 解密 /// </summary> /// <param name="cryptoText">密文</param> /// <param name="decryptKey">解密密钥</param> /// <returns></returns> public string Decrypt(string cryptoText, string decryptKey) { if (!string.IsNullOrEmpty(decryptKey)) { this.key = decryptKey; mCrypto.Key = GetLegalKey(); } byte[] arrCryptoText = Convert.FromBase64String(cryptoText); using (MemoryStream stream = new MemoryStream(arrCryptoText, 0, arrCryptoText.Length)) { ICryptoTransform decryptor = mCrypto.CreateDecryptor(); using (CryptoStream cStream = new CryptoStream(stream, decryptor, CryptoStreamMode.Read)) { StreamReader reader = new StreamReader(cStream); return(reader.ReadToEnd()); } } }
public override ICryptoTransform CreateDecryptor() => _impl.CreateDecryptor();