当前位置: 首页>>代码示例>>C#>>正文


C# PkixCertPath.Equals方法代码示例

本文整理汇总了C#中Org.BouncyCastle.Pkix.PkixCertPath.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# PkixCertPath.Equals方法的具体用法?C# PkixCertPath.Equals怎么用?C# PkixCertPath.Equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Org.BouncyCastle.Pkix.PkixCertPath的用法示例。


在下文中一共展示了PkixCertPath.Equals方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PerformTest

		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();
		}
开发者ID:KimikoMuffin,项目名称:bc-csharp,代码行数:71,代码来源:CertPathTest.cs


注:本文中的Org.BouncyCastle.Pkix.PkixCertPath.Equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。