Skip to content

crypto/x509: x509 DN ordering #11966

Description

@szechyjs

It seems that ToRDNSequence creates a DN with a non standard ordering.

https://github.com/golang/go/blob/master/src/crypto/x509/pkix/pkix.go#L130

This produces a cert with the subject line: C=US, O=Example Org, OU=Security, L=City Name, ST=State, CN=server.example.org

Note how O and OU come before state and locality, and state and locality are in the wrong order.

Typically the subject lines use this ordering: C=US, ST=State, L=City Name, O=Example Org, OU=Security, CN=server.example.org

Some examples I've pulled from the web:

C=US, ST=California, L=Mountain View, O=Google Inc, CN=*.google.com
C=US, ST=California, L=San Jose, O=PayPal, Inc., OU=PayPal Production, CN=paypal.com
C=US, ST=CA, L=Menlo Park, O=Facebook, Inc., CN=*.facebook.com
C=US, ST=Washington, L=Seattle, O=Amazon.com, Inc., CN=www.amazon.com
C=GB, ST=Greater Manchester, L=Salford, O=COMODO CA Limited, CN=COMODO RSA Certification Authority

Some EV Certs, which are probably outside the scope of this bug but I thought I would include them.

1.3.6.1.4.1.311.60.2.1.3=US, 1.3.6.1.4.1.311.60.2.1.2=Delaware, businessCategory=Private Organization, serialNumber=2158113, C=US, postalCode=94043, ST=California, L=Mountain View, street=350 Ellis Street, O=Symantec Corporation, OU=Infrastructure Operations, CN=www.verisign.com
businessCategory=Private Organization, 1.3.6.1.4.1.311.60.2.1.3=US, 1.3.6.1.4.1.311.60.2.1.2=Delaware, serialNumber=5157550, street=548 4th Street, postalCode=94107, C=US, ST=California, L=San Francisco, O=GitHub, Inc., CN=github.com
1.3.6.1.4.1.311.60.2.1.3=US, 1.3.6.1.4.1.311.60.2.1.2=Pennsylvania, businessCategory=Private Organization, serialNumber=754401, C=US, postalCode=15222, ST=Pennsylvania, L=Pittsburgh, street=249 Fifth Ave., O=The PNC Financial Services Group, Inc., OU=Secure Edge Server - A, CN=www.pnc.com

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions