From 70abb7b40806c9246bda5dea88feed59b003fd80 Mon Sep 17 00:00:00 2001 From: Martin Bartosch Date: Tue, 23 Feb 2021 10:46:30 +0100 Subject: [PATCH] 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. --- src/crypto/x509/pkix/pkix.go | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/crypto/x509/pkix/pkix.go b/src/crypto/x509/pkix/pkix.go index 62ae065496..f10bf30a29 100644 --- a/src/crypto/x509/pkix/pkix.go +++ b/src/crypto/x509/pkix/pkix.go @@ -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,