コード例 #1
0
        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");
            }
        }