public void SignHashInvalidHashAlgorithmThrows() { byte[] hashVal; using (Gost3411 gostHash = Gost3411.Create()) { hashVal = gostHash.ComputeHash(bytesToHash); } using (var gost = GetGostProvider()) { Assert.ThrowsAny <CryptographicException>(() => gost.SignHash(hashVal, HashAlgorithmName.SHA256)); } }
public void SignHashDefaultAlgorithmSuccess() { byte[] hashVal; using (Gost3411 gostHash = Gost3411.Create()) { hashVal = gostHash.ComputeHash(bytesToHash); } using (var gost = GetGostProvider()) { byte[] signVal = gost.SignHash(hashVal); Assert.True(gost.VerifyHash(hashVal, signVal)); } }