本文整理匯總了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");
}
}