public override void PerformTest() { X509CertificateParser cf = new X509CertificateParser(); X509Certificate rootCert = cf.ReadCertificate(rootCertBin); X509Certificate interCert = cf.ReadCertificate(interCertBin); X509Certificate finalCert = cf.ReadCertificate(finalCertBin); //Testing CertPath generation from List IList list = new ArrayList(); list.Add(interCert); // CertPath certPath1 = cf.generateCertPath(list); PkixCertPath certPath1 = new PkixCertPath(list); //Testing CertPath encoding as PkiPath byte[] encoded = certPath1.GetEncoded("PkiPath"); //Testing CertPath generation from InputStream MemoryStream inStream = new MemoryStream(encoded, false); // CertPath certPath2 = cf.generateCertPath(inStream, "PkiPath"); PkixCertPath certPath2 = new PkixCertPath(inStream, "PkiPath"); //Comparing both CertPathes if (!certPath2.Equals(certPath1)) { Fail("CertPath differ after encoding and decoding."); } encoded = certPath1.GetEncoded("PKCS7"); //Testing CertPath generation from InputStream inStream = new MemoryStream(encoded, false); // certPath2 = cf.generateCertPath(inStream, "PKCS7"); certPath2 = new PkixCertPath(inStream, "PKCS7"); //Comparing both CertPathes if (!certPath2.Equals(certPath1)) { Fail("CertPath differ after encoding and decoding."); } encoded = certPath1.GetEncoded("PEM"); //Testing CertPath generation from InputStream inStream = new MemoryStream(encoded, false); // certPath2 = cf.generateCertPath(inStream, "PEM"); certPath2 = new PkixCertPath(inStream, "PEM"); //Comparing both CertPathes if (!certPath2.Equals(certPath1)) { Fail("CertPath differ after encoding and decoding."); } // // empty list test // list = new ArrayList(); // CertPath certPath = CertificateFactory.GetInstance("X.509","BC").generateCertPath(list); PkixCertPath certPath = new PkixCertPath(list); if (certPath.Certificates.Count != 0) { Fail("list wrong size."); } // // exception tests // doTestExceptions(); }