當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。