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