本文整理汇总了C#中System.Security.Cryptography.AesManaged.Decrypt方法的典型用法代码示例。如果您正苦于以下问题:C# AesManaged.Decrypt方法的具体用法?C# AesManaged.Decrypt怎么用?C# AesManaged.Decrypt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Security.Cryptography.AesManaged
的用法示例。
在下文中一共展示了AesManaged.Decrypt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Decrypt
/// <summary>
/// Returns a binary array of decrypted data for the given parameters.
/// </summary>
/// <param name="source">Binary array of data to decrypt.</param>
/// <param name="startIndex">Offset into <paramref name="source"/> buffer.</param>
/// <param name="length">Number of bytes in <paramref name="source"/> buffer to decrypt starting from <paramref name="startIndex"/> offset.</param>
/// <param name="key">Encryption key to use to decrypt data.</param>
/// <param name="iv">Initialization vector to use to decrypt data.</param>
/// <param name="strength">Cryptographic strength to use when decrypting data.</param>
/// <returns>A decrypted version of the source data.</returns>
public static byte[] Decrypt(this byte[] source, int startIndex, int length, byte[] key, byte[] iv, CipherStrength strength)
{
if (strength == CipherStrength.None)
return source;
AesManaged symmetricAlgorithm = new AesManaged();
symmetricAlgorithm.KeySize = (int)strength;
return symmetricAlgorithm.Decrypt(source, startIndex, length, key, iv);
}