Exemplo n.º 1
0
        public static void PrintComplexForwards()
        {
            byte[] encoded           = MicrosoftDotComSubject.HexToByteArray();
            X500DistinguishedName dn = new X500DistinguishedName(encoded);

            const string expected =
                ", SERIALNUMBER=600413485, C=US, PostalCode=98052, S=Washington, L=Redmond, " +
                "STREET=1 Microsoft Way, O=Microsoft Corporation, OU=MSCOM, CN=www.microsoft.com";

            Assert.EndsWith(expected, dn.Decode(X500DistinguishedNameFlags.None), StringComparison.Ordinal);
        }
Exemplo n.º 2
0
        public static void PrintComplexReversed()
        {
            byte[] encoded           = MicrosoftDotComSubject.HexToByteArray();
            X500DistinguishedName dn = new X500DistinguishedName(encoded);

            const string expected =
                "CN=www.microsoft.com, OU=MSCOM, O=Microsoft Corporation, STREET=1 Microsoft Way, " +
                "L=Redmond, S=Washington, PostalCode=98052, C=US, SERIALNUMBER=600413485, ";

            // Windows 8.1 would continue the string with some unknown OIDs, but OpenSSL 1.0.1 can decode
            // at least businessCategory (2.5.4.15), and other Windows versions may do so in the future.
            //    "OID.2.5.4.15=Private Organization, OID.1.3.6.1.4.1.311.60.2.1.2=Washington, " +
            //    "OID.1.3.6.1.4.1.311.60.2.1.3=US";

            Assert.StartsWith(expected, dn.Decode(X500DistinguishedNameFlags.Reversed), StringComparison.Ordinal);
        }