From 9b27d0d80ebfdab86f3b54d64f194e726818d236 Mon Sep 17 00:00:00 2001 From: aklyachkin Date: Mon, 8 Feb 2021 13:17:54 +0100 Subject: [PATCH] support for E attribute in CSR --- csr/csr.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/csr/csr.go b/csr/csr.go index 1660e9da0..f26ca132a 100644 --- a/csr/csr.go +++ b/csr/csr.go @@ -37,6 +37,7 @@ type Name struct { L string `json:"L,omitempty" yaml:"L,omitempty"` // Locality O string `json:"O,omitempty" yaml:"O,omitempty"` // OrganisationName OU string `json:"OU,omitempty" yaml:"OU,omitempty"` // OrganisationalUnitName + E string `json:"E,omitempty" yaml:"E,omitempty"` SerialNumber string `json:"SerialNumber,omitempty" yaml:"SerialNumber,omitempty"` OID map[string]string `json:"OID,omitempty", yaml:"OID,omitempty"` } @@ -195,6 +196,9 @@ func (cr *CertificateRequest) Name() (pkix.Name, error) { } name.ExtraNames = append(name.ExtraNames, pkix.AttributeTypeAndValue{Type: oid, Value: v}) } + if n.E != "" { + name.ExtraNames = append(name.ExtraNames, pkix.AttributeTypeAndValue{Type: asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 9, 1}, Value: n.E}) + } } name.SerialNumber = cr.SerialNumber return name, nil