當前位置: 首頁>>代碼示例>>C#>>正文


C# AesManaged.Decrypt方法代碼示例

本文整理匯總了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);
        }
開發者ID:avs009,項目名稱:gsf,代碼行數:21,代碼來源:Cipher.cs


注:本文中的System.Security.Cryptography.AesManaged.Decrypt方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。