Example #1
0
        protected override byte[] HashData(Stream data, HashAlgorithmName hashAlgorithm)
        {
            // we're sealed and the base should have checked this already
            Debug.Assert(data != null);
            Debug.Assert(!string.IsNullOrEmpty(hashAlgorithm.Name));

            using (HashAlgorithm hash = Gost3411_2012_256.Create())
            {
                return(hash.ComputeHash(data));
            }
        }
Example #2
0
        protected override byte[] HashData(byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm)
        {
            // we're sealed and the base should have checked this already
            Debug.Assert(data != null);
            Debug.Assert(count >= 0 && count <= data.Length);
            Debug.Assert(offset >= 0 && offset <= data.Length - count);
            Debug.Assert(!string.IsNullOrEmpty(hashAlgorithm.Name));

            using (HashAlgorithm hash = Gost3411_2012_256.Create())
            {
                return(hash.ComputeHash(data, offset, count));
            }
        }
Example #3
0
        public Gost3410_2012_256CryptoServiceProvider(IntPtr hProvHandle, int keySpec)
        {
            _safeProvHandle = new SafeProvHandle(hProvHandle, true);
            _keySpec        = keySpec;

            LegalKeySizesValue = new KeySizes[] { new KeySizes(
                                                      GostConstants.GOST3410_2012_256KEY_SIZE, GostConstants.GOST3410_2012_256KEY_SIZE, 0) };
            _safeKeyHandle = CapiHelper.GetKeyPairHelper(
                CspAlgorithmType.Gost2012_256,
                keySpec,
                GostConstants.GOST3410_2012_256KEY_SIZE,
                _safeProvHandle);
            _hashImpl = Gost3411_2012_256.Create();
        }
Example #4
0
        public Gost3410_2012_256CryptoServiceProvider(CspParameters parameters)
        {
            _parameters = CapiHelper.SaveCspParameters(
                CapiHelper.CspAlgorithmType.Gost2012_256,
                parameters,
                s_useMachineKeyStore,
                out _randomKeyContainer);
            _keySpec           = _parameters.KeyNumber;
            LegalKeySizesValue = new KeySizes[] { new KeySizes(GostConstants.GOST3410_2012_256KEY_SIZE, GostConstants.GOST3410_2012_256KEY_SIZE, 0) };

            _hashImpl = Gost3411_2012_256.Create();
            if (!_randomKeyContainer)
            {
                GetKeyPair();
            }
        }