Skip to content

Commit 70abb7b

Browse files
committed
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.
1 parent 08543f0 commit 70abb7b

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

src/crypto/x509/pkix/pkix.go

+18-9
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,24 @@ type AlgorithmIdentifier struct {
2424
type RDNSequence []RelativeDistinguishedNameSET
2525

2626
var attributeTypeNames = map[string]string{
27-
"2.5.4.6": "C",
28-
"2.5.4.10": "O",
29-
"2.5.4.11": "OU",
30-
"2.5.4.3": "CN",
31-
"2.5.4.5": "SERIALNUMBER",
32-
"2.5.4.7": "L",
33-
"2.5.4.8": "ST",
34-
"2.5.4.9": "STREET",
35-
"2.5.4.17": "POSTALCODE",
27+
"2.5.4.6": "C",
28+
"2.5.4.10": "O",
29+
"2.5.4.11": "OU",
30+
"2.5.4.3": "CN",
31+
"2.5.4.5": "SERIALNUMBER",
32+
"2.5.4.7": "L",
33+
"2.5.4.8": "ST",
34+
"2.5.4.9": "STREET",
35+
"2.5.4.17": "POSTALCODE",
36+
"0.9.2342.19200300.100.1.25": "DC", // domainComponent
37+
"2.5.4.46": "DNQUALIFIER",
38+
"1.2.840.113549.1.9.1": "EMAIL", // emailAddress
39+
"2.5.4.12": "TITLE",
40+
"2.5.4.4": "SN", // surname
41+
"2.5.4.42": "GIVENNAME",
42+
"2.5.4.43": "INITIALS",
43+
"2.5.4.44": "GENERATIONQUALIFIER",
44+
"2.5.4.65": "PSEUDONYM",
3645
}
3746

3847
// String returns a string representation of the sequence r,

0 commit comments

Comments
 (0)