public void ValidityAuthenticationChain() { ReadData dataTest = new ReadData("beidpkcs11.dll"); Integrity integrityTest = new Integrity(); List<byte[]> caCerts = new List <byte[]>(); caCerts.Add(dataTest.GetCertificateCAFile()); Assert.True(integrityTest.CheckCertificateChain( caCerts, dataTest.GetCertificateAuthenticationFile())); }
public void SignSignature() { // Sign Sign signTest = new Sign("beidpkcs11.dll"); byte[] testdata = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; byte[] signeddata = signTest.DoSign(testdata, "Signature"); Assert.IsNotNull(signeddata); // Verification ReadData dataTest = new ReadData("beidpkcs11.dll"); Integrity integrityTest = new Integrity(); Assert.False(integrityTest.Verify(testdata, signeddata, dataTest.GetCertificateAuthenticationFile())); Assert.True(integrityTest.Verify(testdata, signeddata, dataTest.GetCertificateSignatureFile())); }