From aedb3988d6ee118615fa3854c96068baec7e02e8 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Tue, 29 Mar 2016 13:26:46 +0200 Subject: Always add dnsnames and emails --- crypto.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/crypto.go b/crypto.go index e3be942..f57296b 100644 --- a/crypto.go +++ b/crypto.go @@ -103,13 +103,9 @@ func NewKey(size int) (crypto.PrivateKey, error) { func NewCSR(key crypto.PrivateKey, altnames, emails []string) (string, error) { tmpl := x509.CertificateRequest{ - Subject: pkix.Name{CommonName: altnames[0]}, - } - if len(altnames) > 1 { - tmpl.DNSNames = altnames - } - if len(emails) > 0 { - tmpl.EmailAddresses = emails + Subject: pkix.Name{CommonName: altnames[0]}, + DNSNames: altnames, + EmailAddresses: emails, } der, err := x509.CreateCertificateRequest(rand.Reader, &tmpl, key) if err != nil { -- cgit v1.2.3