aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2016-03-29 13:26:46 +0200
committerDimitri Sokolyuk <demon@dim13.org>2016-03-29 13:26:46 +0200
commitaedb3988d6ee118615fa3854c96068baec7e02e8 (patch)
tree9b6743ce84322fcdcee22ee36c824188cfc8315a
parent7d08003db4be688062916a4aab2dd4794f0acffa (diff)
Always add dnsnames and emails
-rw-r--r--crypto.go10
1 files 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 {