Example #1
0
 public void GetAndTestIdFile()
 {
     ReadData dataTest = new ReadData("beidpkcs11.dll");
     Integrity integrityTest = new Integrity();
     byte[] idFile = dataTest.GetIdFile();
     byte[] idSignatureFile = dataTest.GetIdSignatureFile();
     byte[] certificateRRN = null;
        // Assert.False(integrityTest.Verify(idFile, idSignatureFile, certificateRRN));
 }
Example #2
0
 public void IntegrityIdentityFileWrongCertificate()
 {
     ReadData dataTest = new ReadData("beidpkcs11.dll");
     Integrity integrityTest = new Integrity();
     byte[] idFile = dataTest.GetIdFile();
     byte[] idSignatureFile = dataTest.GetIdSignatureFile();
     byte[] certificateRoot = dataTest.GetCertificateRootFile();
     Assert.False(integrityTest.Verify(idFile, idSignatureFile, certificateRoot));
 }
Example #3
0
        public void GetAndTestIdFile()
        {
            ReadData  dataTest      = new ReadData("beidpkcs11.dll");
            Integrity integrityTest = new Integrity();

            byte[] idFile          = dataTest.GetIdFile();
            byte[] idSignatureFile = dataTest.GetIdSignatureFile();
            //byte[] certificateRRN = null;
            //Assert.isFalse(integrityTest.Verify(idFile, idSignatureFile, certificateRRN));
        }
 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()));
 }
Example #5
0
 public void IntegrityAddressFile()
 {
     ReadData dataTest = new ReadData("beidpkcs11.dll");
     Integrity integrityTest = new Integrity();
     byte[] addressFile = trimRight(dataTest.GetAddressFile());
     byte[] idSignatureFile = dataTest.GetIdSignatureFile();
     byte[] concatFiles = new byte[addressFile.Length + idSignatureFile.Length];
     Array.Copy(addressFile, 0, concatFiles, 0, addressFile.Length);
     Array.Copy(idSignatureFile, 0, concatFiles, addressFile.Length, idSignatureFile.Length);
     byte[] addressSignatureFile = dataTest.GetAddressSignatureFile();
     byte[] certificateRRN = dataTest.GetCertificateRNFile();
     Assert.True(integrityTest.Verify(concatFiles, addressSignatureFile, certificateRRN));
 }
Example #6
0
 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()));
 }