本文整理匯總了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);
}