diff options
| author | Jeremy Clerc <jclerc@google.com> | 2015-09-11 22:51:40 +0200 |
|---|---|---|
| committer | Jeremy Clerc <jeremy@clerc.io> | 2015-09-11 22:51:40 +0200 |
| commit | e76f84ef8e0b8c2037a8987e951e8887cd12fbf5 (patch) | |
| tree | c92f803bbb553bf949dbfa8207827a92b72fe212 /pkg/easyca | |
| parent | df6776142e8974dad88294498847094c903f4164 (diff) | |
| download | easypki-e76f84ef8e0b8c2037a8987e951e8887cd12fbf5.tar.xz | |
add OU params, put entire subject in index.txt
Diffstat (limited to 'pkg/easyca')
| -rw-r--r-- | pkg/easyca/easyca.go | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/pkg/easyca/easyca.go b/pkg/easyca/easyca.go index 92f950a..a0fff16 100644 --- a/pkg/easyca/easyca.go +++ b/pkg/easyca/easyca.go @@ -322,14 +322,32 @@ func WriteIndex(pkiroot, filename string, crt *x509.Certificate) error { if len(serialOutput)%2 == 1 { serialOutput = "0" + serialOutput } - // subject: /C=FR/ST=IDF/O=Umbrella Corporation/CN=test.clerc.io + // Date format: yymmddHHMMSSZ // E|R|V<tab>Expiry<tab>[RevocationDate]<tab>Serial<tab>filename<tab>SubjectDN + var subject string + if strs := crt.Subject.Country; len(strs) == 1 { + subject += "/C=" + strs[0] + } + if strs := crt.Subject.Organization; len(strs) == 1 { + subject += "/O=" + strs[0] + } + if strs := crt.Subject.OrganizationalUnit; len(strs) == 1 { + subject += "/OU=" + strs[0] + } + if strs := crt.Subject.Locality; len(strs) == 1 { + subject += "/L=" + strs[0] + } + if strs := crt.Subject.Province; len(strs) == 1 { + subject += "/ST=" + strs[0] + } + subject += "/CN=" + crt.Subject.CommonName + n, err := fmt.Fprintf(f, "V\t%vZ\t\t%v\t%v.crt\t%v\n", crt.NotAfter.UTC().Format("060102150405"), serialOutput, filename, - "/CN="+crt.Subject.CommonName) + subject) if err != nil { return err } |
