public void TestExtendingPermitted() { TestVerificationContext context = new TestVerificationContext { IsExtendingAllowed = true }; Verify(context, VerificationResultCode.Ok); }
public void TestExtendingNotPermitted() { TestVerificationContext context = new TestVerificationContext { IsExtendingAllowed = false }; Verify(context, VerificationResultCode.Na); }
/// <summary> /// Verification exception on missing KSI signature /// </summary> public void TestContextMissingSignature(TestVerificationContext context) { KsiVerificationException ex = Assert.Throws <KsiVerificationException>(delegate { Rule.Verify(context); }, "Exception expected but non thrown. Rule: " + Rule); Assert.That(ex.Message, Does.StartWith("Invalid KSI signature in context: null"), "Unexpected exception message. Rule: " + Rule); }
public void TestContextUserPublicationIsSet() { TestVerificationContext context = new TestVerificationContext() { UserPublication = new PublicationData("AAAAAA-CVZ2AQ-AAIVXJ-PLJDAG-JMMYUC-OTP2GA-ELBIDQ-OKDY3C-C3VEH2-AR35I2-OJUACP-GOGD6K") }; Verify(context, VerificationResultCode.Ok); }
public void OkResultRuleTest() { OkResultRule rule = new OkResultRule(); TestVerificationContext context = new TestVerificationContext(); VerificationResult verificationResult = rule.Verify(context); Assert.AreEqual(VerificationResultCode.Ok, verificationResult.ResultCode); }
public void TestSignatureWithInvalidContextExtendFunctions() { TestVerificationContext context = new TestVerificationContext() { UserPublication = GetUserPublication("015A7F7D504E5E146EE34E64F831A6B6C7D65291EAEC46FACF60ED6ACA72BCB2DE") }; TestSignatureWithInvalidContextExtendFunctions(context); }
public void TestSignatureMissingCalendarAuthRecord() { TestVerificationContext context = new TestVerificationContext(TestUtil.GetSignature(Resources.KsiSignature_Ok_AggregationHashChain_Only)) { PublicationsFile = new TestPublicationsFile() }; TestSignatureMissingCalendarAuthRecord(context); }
public void TestSignatureWithPublicationFile() { TestVerificationContext context = new TestVerificationContext() { Signature = TestUtil.GetSignature(), PublicationsFile = TestUtil.GetPublicationsFile() }; Verify(context, VerificationResultCode.Ok); }
/// <summary> /// Verification exception on missing publications file /// </summary> public void TestContextMissingPublicationsFile(IKsiSignature signature = null) { TestVerificationContext context = new TestVerificationContext(signature ?? TestUtil.GetSignature(Resources.KsiSignature_Ok_With_Publication_Record)); KsiVerificationException ex = Assert.Throws <KsiVerificationException>(delegate { Rule.Verify(context); }); Assert.That(ex.Message, Does.StartWith("Invalid publications file in context: null")); }
public override void TestContextMissingSignature() { TestVerificationContext context = new TestVerificationContext() { ExtendedCalendarHashChain = TestUtil.GetSignature(Resources.KsiSignature_Ok_Extended).CalendarHashChain, UserPublication = GetUserPublication(1455494400) }; TestContextMissingSignature(context); }
/// <summary> /// Verification exception on missing publications file /// </summary> public void TestContextMissingUserPublication(IKsiSignature signature = null) { TestVerificationContext context = new TestVerificationContext(signature ?? TestUtil.GetSignature()); KsiVerificationException ex = Assert.Throws <KsiVerificationException>(delegate { Rule.Verify(context); }); Assert.That(ex.Message, Does.StartWith("Invalid user publication in context: null")); }
public void TestRfc3161SignatureWithPublicationsFile() { TestVerificationContext context = new TestVerificationContext() { Signature = TestUtil.GetSignature(Resources.KsiSignature_Legacy_Ok), PublicationsFile = TestUtil.GetPublicationsFile() }; Verify(context, VerificationResultCode.Ok); }
public void TestSignatureWithInvalidContextExtendFunctions() { // Check invalid extended calendar chain when service returns null TestVerificationContext context = new TestVerificationContext() { Signature = TestUtil.GetSignature() }; TestSignatureWithInvalidContextExtendFunctions(context); }
public void TestSignatureWithInvalidCalendarAuthenticationRecordSignature() { TestVerificationContext context = new TestVerificationContext() { Signature = TestUtil.GetSignature(Resources.KsiSignature_Invalid_Calendar_Authentication_Record_Invalid_Signature), PublicationsFile = TestUtil.GetPublicationsFile() }; Verify(context, VerificationResultCode.Fail, VerificationError.Key02); }
public void TestSignatureWithInvalidUserPublicationTime() { // Check invalid signature TestVerificationContext context = new TestVerificationContext() { Signature = TestUtil.GetSignature(Resources.KsiSignature_Ok), UserPublication = GetUserPublication(1455478441) }; Verify(context, VerificationResultCode.Na); }
public void TestRfc3161SignatureWithUserPublicationTime() { // Check extended legacy signature TestVerificationContext context = new TestVerificationContext() { Signature = TestUtil.GetSignature(Resources.KsiSignature_Legacy_Ok), UserPublication = GetUserPublication(1439596800) }; Verify(context, VerificationResultCode.Ok); }
public void TestSignatureWithAggregationChainOnly() { // Check signature with aggregation chain only. TestVerificationContext context = new TestVerificationContext() { Signature = TestUtil.GetSignature(Resources.KsiSignature_Ok_AggregationHashChain_Only), UserPublication = GetUserPublication(1439596800) }; Verify(context, VerificationResultCode.Ok); }
public void TestSignatureExtendedCalendarHashChainInputHashMismatch() { // Check invalid signature with extended calendar hash chain input hash mistmatch TestVerificationContext context = new TestVerificationContext() { Signature = TestUtil.GetSignature(), ExtendedCalendarHashChain = GetExtendedCalendarHashChain("01580192B0D06E48884432DFFC26A67C6C685BEAF0252B9DD2A0B4B05D1724C5F2") }; Verify(context, VerificationResultCode.Fail, VerificationError.Cal02); }
public void TestSignatureMissingCalendarHashChain() { // Check signature without calendar chain TestVerificationContext context = new TestVerificationContext() { Signature = TestUtil.GetSignature(Resources.KsiSignature_Ok_AggregationHashChain_Only), LatestCalendarHashChain = GetExtendedCalendarHashChain("01E8E1FB57586DFE67D5B541FCE6CFC78684E4C38ED87784D97FFA7FEB81DB7D1E") }; Verify(context, VerificationResultCode.Ok); }
public void TestSignatureWithInvalidContextExtendFunctions() { // Check invalid extended calendar chain from context extension function TestVerificationContext context = new TestVerificationContext() { Signature = TestUtil.GetSignature(), UserPublication = GetUserPublication() }; TestSignatureWithInvalidContextExtendFunctions(context); }
public void TestRfc3161SignatureCalendarhHashChainInputHash() { // Check legacy signature TestVerificationContext context = new TestVerificationContext() { Signature = TestUtil.GetSignature(Resources.KsiSignature_Legacy_Ok), ExtendedCalendarHashChain = GetExtendedCalendarHashChain("01145C6CDA9F901A65C0B3C09896675928E1A85977280BF65C0A638C8A47BB358A") }; Verify(context, VerificationResultCode.Ok); }
public void TestPublicationsFileMissingNewerPublicationRecord() { // Check no publication found after current signature TestVerificationContext context = new TestVerificationContext() { Signature = TestUtil.GetSignature(Resources.KsiSignature_Ok), PublicationsFile = new TestPublicationsFile() }; Verify(context, VerificationResultCode.Na); }
public void TestSignatureWithInvalidContextExtendFunctions() { //// Check invalid extended calendar chain from context function: null TestVerificationContext context = new TestVerificationContext() { Signature = TestUtil.GetSignature(Resources.KsiSignature_Invalid_Missing_Calendar_Authentication_Record), PublicationsFile = GetPublicationsFile(1455478441, "01B746442100F4C41F556B8D186FEF33A062234808BECF236A9EB8D23485CD4C3E") }; TestSignatureWithInvalidContextExtendFunctions(context); }
public void TestSignatureMissingCalendarAuthRecord() { // Check signature with no calendar authentication record TestVerificationContext context = new TestVerificationContext() { Signature = TestUtil.GetSignature(Resources.KsiSignature_Invalid_Missing_Calendar_Authentication_Record), PublicationsFile = new TestPublicationsFile() }; TestSignatureMissingCalendarAuthRecord(context); }
public void TestSignatureWithPublicationsFileMissingCertificateId() { // Check invalid signature with invalid certificate id TestVerificationContext context = new TestVerificationContext() { Signature = TestUtil.GetSignature(), PublicationsFile = new TestPublicationsFile() }; Verify(context, VerificationResultCode.Fail, VerificationError.Key01); }
public void TestSignatureWithPublicationHashMismatch() { // Check signature publication record against publications file. Publication hash mismatch. TestVerificationContext context = new TestVerificationContext() { Signature = TestUtil.GetSignature(Resources.KsiSignature_Ok_With_Publication_Record), PublicationsFile = GetPublicationsFile(1439596800, 1439596800, "0125BA5EB48C064B198A09D37E8C022C281C1CA1E36216EA43E811DF51A7268014") }; Verify(context, VerificationResultCode.Fail, VerificationError.Pub05); }
public void TestHashesMatch() { // Check signature with publication record TestVerificationContext context = new TestVerificationContext() { ExtendedCalendarHashChain = GetExtendedCalendarHashChain(), UserPublication = GetUserPublication("015A7F7D504E5E146EE34E64F831A6B6C7D65291EAEC46FACF60ED6ACA72BCB2DE") }; Verify(context, VerificationResultCode.Ok); }
public void TestSignatureCalendarHashChainInputHash() { // Check signature TestVerificationContext context = new TestVerificationContext() { Signature = TestUtil.GetSignature(), ExtendedCalendarHashChain = GetExtendedCalendarHashChain("012C8149F374FDDCD5443456BC7E8FFA310B7FE090DAA98C0980B81EC2407FD013") }; Verify(context, VerificationResultCode.Ok); }
public void TestSignatureWithInvalidContextExtendFunctions() { // Check missing extended calendar chain TestVerificationContext context = new TestVerificationContext() { Signature = TestUtil.GetSignature(Resources.KsiSignature_Ok), PublicationsFile = GetPublicationsFile(1455478441, 1455494400), }; TestSignatureWithInvalidContextExtendFunctions(context); }
public void TestHashesMismatch() { // publication hashes mismatch TestVerificationContext context = new TestVerificationContext() { ExtendedCalendarHashChain = GetExtendedCalendarHashChain(), UserPublication = GetUserPublication("01580192B0D06E48884432DFFC26A67C6C685BEAF0252B9DD2A0B4B05D1724C5F2") }; Verify(context, VerificationResultCode.Fail, VerificationError.Pub01); }