From 50b8c9f09ff7e1ec1338236372d960cc7d80cf1f Mon Sep 17 00:00:00 2001 From: Filippo Valsorda Date: Sat, 2 Feb 2019 14:45:36 -0500 Subject: [PATCH] Set the CommonName when generating PKCS#12 files Fixes #115 --- cert.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cert.go b/cert.go index 79d5975..9741cf8 100644 --- a/cert.go +++ b/cert.go @@ -25,7 +25,7 @@ import ( "strings" "time" - "software.sslmate.com/src/go-pkcs12" + pkcs12 "software.sslmate.com/src/go-pkcs12" ) var userAndHostname string @@ -73,6 +73,12 @@ func (m *mkcert) makeCert(hosts []string) { } } + // IIS (the main target of PKCS #12 files), only shows the deprecated + // Common Name in the UI. See issue #115. + if m.pkcs12 { + tpl.Subject.CommonName = hosts[0] + } + pub := priv.PublicKey cert, err := x509.CreateCertificate(rand.Reader, tpl, m.caCert, &pub, m.caKey) fatalIfErr(err, "failed to generate certificate")