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


C# GeneralName.GetEncoded方法代码示例

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


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

示例1: PerformTest

		public override void PerformTest()
		{
			GeneralName nm = new GeneralName(GeneralName.IPAddress, "10.9.8.0");
			if (!Arrays.AreEqual(nm.GetEncoded(), ipv4))
			{
				Fail("ipv4 encoding failed");
			}

			nm = new GeneralName(GeneralName.IPAddress, "10.9.8.0/255.255.255.0");
			if (!Arrays.AreEqual(nm.GetEncoded(), ipv4WithMask))
			{
				Fail("ipv4 with netmask 1 encoding failed");
			}

			nm = new GeneralName(GeneralName.IPAddress, "10.9.8.0/24");
			if (!Arrays.AreEqual(nm.GetEncoded(), ipv4WithMask))
			{
				Fail("ipv4 with netmask 2 encoding failed");
			}

			nm = new GeneralName(GeneralName.IPAddress, "2001:0db8:85a3:08d3:1319:8a2e:0370:7334");
			if (!Arrays.AreEqual(nm.GetEncoded(), ipv6a))
			{
				Fail("ipv6 with netmask encoding failed");
			}

			nm = new GeneralName(GeneralName.IPAddress, "2001:0db8:85a3::1319:8a2e:0370:7334");
			if (!Arrays.AreEqual(nm.GetEncoded(), ipv6b))
			{
				Fail("ipv6b encoding failed");
			}

			nm = new GeneralName(GeneralName.IPAddress, "::1");
			if (!Arrays.AreEqual(nm.GetEncoded(), ipv6c))
			{
				Fail("ipv6c failed");
			}

			nm = new GeneralName(GeneralName.IPAddress, "2001:0db8:85a3::8a2e:0370:7334");
			if (!Arrays.AreEqual(nm.GetEncoded(), ipv6d))
			{
				Fail("ipv6d failed");
			}

			nm = new GeneralName(GeneralName.IPAddress, "2001:0db8:85a3::8a2e:10.9.8.0");
			if (!Arrays.AreEqual(nm.GetEncoded(), ipv6e))
			{
				Fail("ipv6e failed");
			}

			nm = new GeneralName(GeneralName.IPAddress, "2001:0db8:85a3::8a2e:10.9.8.0/ffff:ffff:ffff::0000");
			if (!Arrays.AreEqual(nm.GetEncoded(), ipv6f))
			{
				Fail("ipv6f failed");
			}

			nm = new GeneralName(GeneralName.IPAddress, "2001:0db8:85a3::8a2e:10.9.8.0/128");
			if (!Arrays.AreEqual(nm.GetEncoded(), ipv6g))
			{
				Fail("ipv6g failed");
			}

			nm = new GeneralName(GeneralName.IPAddress, "2001:0db8:85a3::/48");
			if (!Arrays.AreEqual(nm.GetEncoded(), ipv6h))
			{
				Fail("ipv6h failed");
			}
		}
开发者ID:KimikoMuffin,项目名称:bc-csharp,代码行数:68,代码来源:GeneralNameTest.cs


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