public void IntegrityIdentityFileWrongSignature()
 {
     ReadData dataTest = new ReadData("beidpkcs11.dll");
     Integrity integrityTest = new Integrity();
     byte[] idFile = dataTest.GetIdFile();
     byte[] idSignatureFile = dataTest.GetAddressSignatureFile();
     byte[] certificateRRN = dataTest.GetCertificateRNFile();
     Assert.False(integrityTest.Verify(idFile, idSignatureFile, certificateRRN));
 }
Example #2
0
 public void GetCertificateRNFile()
 {
     ReadData dataTest = new ReadData("beidpkcs11.dll");
     byte[] certificateRNFile = dataTest.GetCertificateRNFile();
     X509Certificate certificateRN;
     Assert.DoesNotThrow(delegate { certificateRN = new X509Certificate(certificateRNFile); });
     certificateRN = new X509Certificate(certificateRNFile);
     Assert.True(certificateRN.Issuer.Contains("Root"));
 }
        public void IntegrityIdentityFileWrongSignature()
        {
            ReadData  dataTest      = new ReadData("beidpkcs11.dll");
            Integrity integrityTest = new Integrity();

            byte[] idFile          = dataTest.GetIdFile();
            byte[] idSignatureFile = dataTest.GetAddressSignatureFile();
            byte[] certificateRRN  = dataTest.GetCertificateRNFile();
            Assert.False(integrityTest.Verify(idFile, idSignatureFile, certificateRRN));
        }
Example #4
0
        public void GetCertificateRNFile()
        {
            ReadData dataTest = new ReadData("beidpkcs11.dll");

            byte[]          certificateRNFile = dataTest.GetCertificateRNFile();
            X509Certificate certificateRN;

            Assert.DoesNotThrow(delegate { certificateRN = new X509Certificate(certificateRNFile); });
            certificateRN = new X509Certificate(certificateRNFile);
            Assert.True(certificateRN.Issuer.Contains("Root"));
        }
Example #5
0
        public void StoreCertificateRNFile()
        {
            ReadData dataTest = new ReadData("beidpkcs11.dll");

            byte[]           certificateRNFile = dataTest.GetCertificateRNFile();
            X509Certificate2 certificateRN     = new X509Certificate2(certificateRNFile);

            X509Store mystore = new X509Store(StoreName.My);

            mystore.Open(OpenFlags.ReadWrite);
            mystore.Add(certificateRN);
        }
 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));
 }
        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 #8
0
        public void GetCertificateRNFile()
        {
            ReadData dataTest = new ReadData("beidpkcs11.dll");

            byte[]          certificateRNFile = dataTest.GetCertificateRNFile();
            X509Certificate certificateRN;

            try
            {
                certificateRN = new X509Certificate(certificateRNFile);
                Assert.IsTrue(certificateRN.Issuer.Contains("Root"));
            }
            catch
            {
                Assert.Fail();
            }
        }
Example #9
0
        public void StoreCertificateRNFile()
        {
            ReadData dataTest = new ReadData("beidpkcs11.dll");
            byte[] certificateRNFile = dataTest.GetCertificateRNFile();
            X509Certificate2 certificateRN = new X509Certificate2(certificateRNFile);

            X509Store mystore = new X509Store(StoreName.My);
            mystore.Open(OpenFlags.ReadWrite);
            mystore.Add(certificateRN);
        }