aboutsummaryrefslogtreecommitdiff
path: root/crypto.go
diff options
context:
space:
mode:
Diffstat (limited to 'crypto.go')
-rw-r--r--crypto.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/crypto.go b/crypto.go
index f6aad30..a8ecb41 100644
--- a/crypto.go
+++ b/crypto.go
@@ -93,13 +93,16 @@ func NewKey(size int) (crypto.PrivateKey, error) {
}
}
-func NewCSR(key crypto.PrivateKey, altnames []string) (string, 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) > 1 {
+ tmpl.EmailAddresses = emails
+ }
der, err := x509.CreateCertificateRequest(rand.Reader, &tmpl, key)
if err != nil {
return "", err