crypto/x509/pkix/pkix: Add missing RFC 5280 RDN OIDs

RFC 5280 section 4.1.2.4 states that conforming implementations
must/should expect a list of attribute types in Subject and
Issuer names. Some of the required attributes were not supported
by pkix.String(). This commit adds support for the missing RDN
attributes.
This commit is contained in:
Martin Bartosch 2021-02-23 10:46:30 +01:00
parent 08543f0715
commit 70abb7b408
1 changed files with 18 additions and 9 deletions

View File

@ -24,15 +24,24 @@ type AlgorithmIdentifier struct {
type RDNSequence []RelativeDistinguishedNameSET
var attributeTypeNames = map[string]string{
"2.5.4.6": "C",
"2.5.4.10": "O",
"2.5.4.11": "OU",
"2.5.4.3": "CN",
"2.5.4.5": "SERIALNUMBER",
"2.5.4.7": "L",
"2.5.4.8": "ST",
"2.5.4.9": "STREET",
"2.5.4.17": "POSTALCODE",
"2.5.4.6": "C",
"2.5.4.10": "O",
"2.5.4.11": "OU",
"2.5.4.3": "CN",
"2.5.4.5": "SERIALNUMBER",
"2.5.4.7": "L",
"2.5.4.8": "ST",
"2.5.4.9": "STREET",
"2.5.4.17": "POSTALCODE",
"0.9.2342.19200300.100.1.25": "DC", // domainComponent
"2.5.4.46": "DNQUALIFIER",
"1.2.840.113549.1.9.1": "EMAIL", // emailAddress
"2.5.4.12": "TITLE",
"2.5.4.4": "SN", // surname
"2.5.4.42": "GIVENNAME",
"2.5.4.43": "INITIALS",
"2.5.4.44": "GENERATIONQUALIFIER",
"2.5.4.65": "PSEUDONYM",
}
// String returns a string representation of the sequence r,