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_512.Create()) { return(hash.ComputeHash(data)); } }
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_512.Create()) { return(hash.ComputeHash(data, offset, count)); } }
public Gost3410_2012_512CryptoServiceProvider(IntPtr hProvHandle, int keySpec) { _safeProvHandle = new SafeProvHandle(hProvHandle, true); _keySpec = keySpec; LegalKeySizesValue = new KeySizes[] { new KeySizes( GostConstants.GOST3410_2012_512KEY_SIZE, GostConstants.GOST3410_2012_512KEY_SIZE, 0) }; _safeKeyHandle = CapiHelper.GetKeyPairHelper( CspAlgorithmType.Gost2012_512, keySpec, GostConstants.GOST3410_2012_512KEY_SIZE, _safeProvHandle); _hashImpl = Gost3411_2012_512.Create(); }
public Gost3410_2012_512CryptoServiceProvider(CspParameters parameters) { _parameters = CapiHelper.SaveCspParameters( CapiHelper.CspAlgorithmType.Gost2012_512, parameters, s_useMachineKeyStore, out _randomKeyContainer); _keySpec = _parameters.KeyNumber; LegalKeySizesValue = new KeySizes[] { new KeySizes(GostConstants.GOST3410_2012_512KEY_SIZE, GostConstants.GOST3410_2012_512KEY_SIZE, 0) }; _hashImpl = Gost3411_2012_512.Create(); if (!_randomKeyContainer) { GetKeyPair(); } }