Beispiel #1
0
        public void SignHashInvalidHashAlgorithmThrows()
        {
            byte[] hashVal;
            using (Gost3411_2012_512 gostHash = Gost3411_2012_512.Create())
            {
                hashVal = gostHash.ComputeHash(bytesToHash);
            }

            using (var gost = GetGostProvider())
            {
                Assert.ThrowsAny <CryptographicException>(() => gost.SignHash(hashVal, HashAlgorithmName.SHA512));
            }
        }
Beispiel #2
0
        public void SignHashDefaultAlgorithmSuccess()
        {
            byte[] hashVal;
            using (Gost3411_2012_512 gostHash = Gost3411_2012_512.Create())
            {
                hashVal = gostHash.ComputeHash(bytesToHash);
            }

            using (var gost = GetGostProvider())
            {
                byte[] signVal = gost.SignHash(hashVal);
                Assert.True(gost.VerifyHash(hashVal, signVal));
            }
        }