public void Verify(Ksi ksi) { VerificationResult result = ksi.Verify(TestUtil.GetSignature(Resources.KsiSignature_Ok)); Assert.AreEqual(VerificationResultCode.Ok, result.ResultCode, "Unexpected verification result code."); Assert.AreEqual(nameof(DefaultVerificationPolicy), result.RuleName, "Unexpected policy used."); }
public void VerifyNewSignature(Ksi ksi) { IKsiSignature signature = ksi.Sign(new DataHash(Base16.Decode("0111A700B0C8066C47ECBA05ED37BC14DCADB238552D86C659342D1D7E87B8772D"))); VerificationResult result = ksi.Verify(signature); Assert.AreEqual(VerificationResultCode.Ok, result.ResultCode, "Unexpected verification result code."); Assert.AreEqual(nameof(DefaultVerificationPolicy), result.RuleName, "Unexpected policy used."); }
public void VerifyWithDocumentHashAndPublicationsFile(Ksi ksi) { VerificationResult result = ksi.Verify(TestUtil.GetSignature(Resources.KsiSignature_Ok), new DataHash(Base16.Decode("0111A700B0C8066C47ECBA05ED37BC14DCADB238552D86C659342D1D7E87B8772D")), TestUtil.GetPublicationsFile()); Assert.AreEqual(VerificationResultCode.Ok, result.ResultCode, "Unexpected verification result code."); Assert.AreEqual(nameof(DefaultVerificationPolicy), result.RuleName, "Unexpected policy used."); }
public void VerifyWithVerificationContextNull(Ksi ksi) { ArgumentNullException ex = Assert.Throws <ArgumentNullException>(delegate { ksi.Verify(new DefaultVerificationPolicy(), null); }); Assert.AreEqual("context", ex.ParamName); }
public void VerifyWithVerificationPolicyNull(Ksi ksi) { ArgumentNullException ex = Assert.Throws <ArgumentNullException>(delegate { ksi.Verify((VerificationPolicy)null, null); }); Assert.AreEqual("policy", ex.ParamName); }
public void VerifyWithSignatureNull2(Ksi ksi) { ArgumentNullException ex = Assert.Throws <ArgumentNullException>(delegate { ksi.Verify(null, null, TestUtil.GetPublicationsFile()); }); Assert.AreEqual("ksiSignature", ex.ParamName); }
public void VerifyWithSignatureNull(Ksi ksi) { ArgumentNullException ex = Assert.Throws <ArgumentNullException>(delegate { ksi.Verify(null); }); Assert.AreEqual("ksiSignature", ex.ParamName); }
public void VerifyFailWithInvalidDocumentHash(Ksi ksi) { VerificationResult result = ksi.Verify(TestUtil.GetSignature(Resources.KsiSignature_Ok), new DataHash(Base16.Decode("01580192B0D06E48884432DFFC26A67C6C685BEAF0252B9DD2A0B4B05D1724C5F2"))); Assert.AreEqual(VerificationResultCode.Fail, result.ResultCode); Assert.AreEqual(VerificationError.Gen01, result.VerificationError); Assert.AreEqual(nameof(DefaultVerificationPolicy), result.RuleName, "Unexpected policy used."); }
public void VerifyWithPublicationsFileNull(Ksi ksi) { ArgumentNullException ex = Assert.Throws <ArgumentNullException>(delegate { ksi.Verify(TestUtil.GetSignature(Resources.KsiSignature_Ok), null, null); }); Assert.AreEqual("publicationsFile", ex.ParamName); }
public void VerifyWithExtendingAllowed(Ksi ksi) { VerificationResult result = ksi.Verify(new DefaultVerificationPolicy(), new VerificationContext(TestUtil.GetSignature(Resources.KsiSignature_Ok)) { PublicationsFile = ksi.GetPublicationsFile(), IsExtendingAllowed = true }); Assert.AreEqual(VerificationResultCode.Ok, result.ResultCode, "Unexpected verification result code."); Assert.AreEqual(nameof(DefaultVerificationPolicy), result.RuleName, "Unexpected policy used."); }