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


C# X509Name.Equivalent方法代码示例

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


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

示例1: equalityTest

		private void equalityTest(
			X509Name	x509Name,
			X509Name	x509Name1)
		{
			if (!x509Name.Equivalent(x509Name1))
			{
				Fail("equality test failed for " + x509Name + " : " + x509Name1);
			}

			// FIXME Sort out X509Name hashcode problem
//			if (x509Name.GetHashCode() != x509Name1.GetHashCode())
//			{
//				Fail("GetHashCode test failed for " + x509Name + " : " + x509Name1);
//			}

			if (!x509Name.Equivalent(x509Name1, true))
			{
				Fail("equality test failed for " + x509Name + " : " + x509Name1);
			}
		}
开发者ID:randombit,项目名称:hacrypto,代码行数:20,代码来源:X509NameTest.cs

示例2: IssuersMatch

		internal static bool IssuersMatch(
			X509Name	a,
			X509Name	b)
		{
			return a == null ? b == null : a.Equivalent(b, true);
		}
开发者ID:ktw,项目名称:OutlookPrivacyPlugin,代码行数:6,代码来源:X509CertStoreSelector.cs

示例3: PerformTest

		public override void PerformTest()
		{
			doTestEncodingPrintableString(X509Name.C, "AU");
			doTestEncodingPrintableString(X509Name.SerialNumber, "123456");
			doTestEncodingPrintableString(X509Name.DnQualifier, "123456");
			doTestEncodingIA5String(X509Name.EmailAddress, "[email protected]");
			doTestEncodingIA5String(X509Name.DC, "test");
			// correct encoding
			doTestEncodingGeneralizedTime(X509Name.DateOfBirth, "#180F32303032303132323132323232305A");
			// compatability encoding
			doTestEncodingGeneralizedTime(X509Name.DateOfBirth, "20020122122220Z");

			//
			// composite
			//
			IDictionary attrs = new Hashtable();
			attrs.Add(X509Name.C, "AU");
			attrs.Add(X509Name.O, "The Legion of the Bouncy Castle");
			attrs.Add(X509Name.L, "Melbourne");
			attrs.Add(X509Name.ST, "Victoria");
			attrs.Add(X509Name.E, "[email protected]");

			IList order = new ArrayList();
			order.Add(X509Name.C);
			order.Add(X509Name.O);
			order.Add(X509Name.L);
			order.Add(X509Name.ST);
			order.Add(X509Name.E);

			X509Name name1 = new X509Name(order, attrs);

			if (!name1.Equivalent(name1))
			{
				Fail("Failed same object test");
			}

			if (!name1.Equivalent(name1, true))
			{
				Fail("Failed same object test - in Order");
			}

			X509Name name2 = new X509Name(order, attrs);

			if (!name1.Equivalent(name2))
			{
				Fail("Failed same name test");
			}

			if (!name1.Equivalent(name2, true))
			{
				Fail("Failed same name test - in Order");
			}

			if (name1.GetHashCode() != name2.GetHashCode())
			{
				Fail("Failed same name test - in Order");
			}

			IList ord1 = new ArrayList();

			ord1.Add(X509Name.C);
			ord1.Add(X509Name.O);
			ord1.Add(X509Name.L);
			ord1.Add(X509Name.ST);
			ord1.Add(X509Name.E);

			IList ord2 = new ArrayList();

			ord2.Add(X509Name.E);
			ord2.Add(X509Name.ST);
			ord2.Add(X509Name.L);
			ord2.Add(X509Name.O);
			ord2.Add(X509Name.C);

			name1 = new X509Name(ord1, attrs);
			name2 = new X509Name(ord2, attrs);

			if (!name1.Equivalent(name2))
			{
				Fail("Failed reverse name test");
			}

			// FIXME Sort out X509Name hashcode problem
//			if (name1.GetHashCode() != name2.GetHashCode())
//			{
//				Fail("Failed reverse name test GetHashCode");
//			}

			if (name1.Equivalent(name2, true))
			{
				Fail("Failed reverse name test - in Order");
			}

			if (!name1.Equivalent(name2, false))
			{
				Fail("Failed reverse name test - in Order false");
			}

			IList oids = name1.GetOidList();
			if (!CompareVectors(oids, ord1))
//.........这里部分代码省略.........
开发者ID:randombit,项目名称:hacrypto,代码行数:101,代码来源:X509NameTest.cs


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