Skip to content

Commit 88d20dd

Browse files
authored
Support SAN for Go 1.15+ (#123)
Starting from Go 1.15+ Certificate without subjectAltName will fail with error: "x509: certificate relies on legacy Common Name field" More info: golang/go#39568 This is only for Domain name and does not support IP Address: https://godoc.org/crypto/x509#Certificate
1 parent c7fb6e6 commit 88d20dd

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

cert.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ func GenerateCertificateKey(commonName string, isCA bool, parent *x509.Certifica
8989
NotAfter: notAfter,
9090
KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature,
9191
ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},
92+
DNSNames: []string{commonName},
9293
}
9394

9495
if isCA {

0 commit comments

Comments
 (0)