当前位置: 首页>>代码示例>>C#>>正文


C# CipherMode.GetCipherIv方法代码示例

本文整理汇总了C#中CipherMode.GetCipherIv方法的典型用法代码示例。如果您正苦于以下问题:C# CipherMode.GetCipherIv方法的具体用法?C# CipherMode.GetCipherIv怎么用?C# CipherMode.GetCipherIv使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CipherMode的用法示例。


在下文中一共展示了CipherMode.GetCipherIv方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TripleDesOpenSslCipher

        public TripleDesOpenSslCipher(CipherMode cipherMode, int blockSizeInBytes, byte[] key, byte[] iv, bool encrypting)
            : base(cipherMode.GetCipherIv(iv), blockSizeInBytes)
        {
            _encrypting = encrypting;

            OpenKey(cipherMode, key);
        }
开发者ID:jeh0,项目名称:corefx,代码行数:7,代码来源:TripleDesOpenSslCipher.cs

示例2: OpenSslCipher

        public OpenSslCipher(IntPtr algorithm, CipherMode cipherMode, int blockSizeInBytes, byte[] key, int effectiveKeyLength, byte[] iv, bool encrypting)
            : base(cipherMode.GetCipherIv(iv), blockSizeInBytes)
        {
            Debug.Assert(algorithm != IntPtr.Zero);

            _encrypting = encrypting;

            OpenKey(algorithm, key, effectiveKeyLength);
        }
开发者ID:dotnet,项目名称:corefx,代码行数:9,代码来源:OpenSslCipher.cs

示例3: BasicSymmetricCipherCsp

        public BasicSymmetricCipherCsp(int algId, CipherMode cipherMode, int blockSizeInBytes, byte[] key, int effectiveKeyLength, bool addNoSaltFlag, byte[] iv, bool encrypting)
            : base(cipherMode.GetCipherIv(iv), blockSizeInBytes)
        {
            _encrypting = encrypting;

            _hProvider = AcquireSafeProviderHandle();
            _hKey = ImportCspBlob(_hProvider, algId, key, addNoSaltFlag);

            SetKeyParameter(_hKey, CryptGetKeyParamQueryType.KP_MODE, (int)cipherMode);

            byte[] currentIv = cipherMode.GetCipherIv(iv);
            if (currentIv != null)
            {
                SetKeyParameter(_hKey, CryptGetKeyParamQueryType.KP_IV, currentIv);
            }

            if (effectiveKeyLength != 0)
            {
                SetKeyParameter(_hKey, CryptGetKeyParamQueryType.KP_EFFECTIVE_KEYLEN, effectiveKeyLength);
            }
        }
开发者ID:dotnet,项目名称:corefx,代码行数:21,代码来源:BasicSymmetricCipherCsp.cs

示例4: AppleCCCryptor

        public AppleCCCryptor(
            Interop.AppleCrypto.PAL_SymmetricAlgorithm algorithm,
            CipherMode cipherMode,
            int blockSizeInBytes,
            byte[] key,
            byte[] iv,
            bool encrypting)
            : base(cipherMode.GetCipherIv(iv), blockSizeInBytes)
        {
            _encrypting = encrypting;

            OpenCryptor(algorithm, cipherMode, key);
        }
开发者ID:swaroop-sridhar,项目名称:corefx,代码行数:13,代码来源:AppleCCCryptor.cs

示例5: TripleDesCngCipher

        private byte[] _currentIv;  // CNG mutates this with the updated IV for the next stage on each Encrypt/Decrypt call.
                                    // The base IV holds a copy of the original IV for Reset(), until it is cleared by Dispose().

        public TripleDesCngCipher(CipherMode cipherMode, int blockSizeInBytes, byte[] key, byte[] iv, bool encrypting)
            : base(cipherMode.GetCipherIv(iv), blockSizeInBytes)
        {
            _encrypting = encrypting;

            if (IV != null)
            {
                _currentIv = new byte[IV.Length];
            }

            SafeAlgorithmHandle hAlg = GetCipherAlgorithm(cipherMode);
            _hKey = hAlg.BCryptImportKey(key);
            Reset();
        }
开发者ID:jeh0,项目名称:corefx,代码行数:17,代码来源:TripleDesCngCipher.cs

示例6: CngCipher

        private byte[] _currentIv;  // CNG mutates this with the updated IV for the next stage on each Encrypt/Decrypt call.
                                    // The base IV holds a copy of the original IV for Reset(), until it is cleared by Dispose().

        public CngCipher(SafeAlgorithmHandle algorithm, CipherMode cipherMode, int blockSizeInBytes, byte[] key, byte[] iv, bool encrypting)
            : base(cipherMode.GetCipherIv(iv), blockSizeInBytes)
        {
            Debug.Assert(algorithm != null);

            _encrypting = encrypting;

            if (IV != null)
            {
                _currentIv = new byte[IV.Length];
            }

            _hKey = algorithm.BCryptImportKey(key);
            Reset();
        }
开发者ID:noahfalk,项目名称:corefx,代码行数:18,代码来源:CngCipher.cs

示例7: BasicSymmetricCipherBCrypt

        private byte[] _currentIv;  // CNG mutates this with the updated IV for the next stage on each Encrypt/Decrypt call.
                                    // The base IV holds a copy of the original IV for Reset(), until it is cleared by Dispose().

        public BasicSymmetricCipherBCrypt(SafeAlgorithmHandle algorithm, CipherMode cipherMode, int blockSizeInBytes, byte[] key, int effectiveKeyLength, byte[] iv, bool encrypting)
            : base(cipherMode.GetCipherIv(iv), blockSizeInBytes)
        {
            Debug.Assert(algorithm != null);

            _encrypting = encrypting;

            if (IV != null)
            {
                _currentIv = new byte[IV.Length];
            }

            _hKey = algorithm.BCryptImportKey(key);

            if (effectiveKeyLength != 0)
            {
                Cng.SetEffectiveKeyLength(_hKey, effectiveKeyLength);
            }

            Reset();
        }
开发者ID:dotnet,项目名称:corefx,代码行数:24,代码来源:BasicSymmetricCipherBCrypt.cs


注:本文中的CipherMode.GetCipherIv方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。