diff --git a/cert.go b/cert.go index 56750aa..eb72660 100644 --- a/cert.go +++ b/cert.go @@ -253,14 +253,16 @@ func (m *mkcert) makeCertFromCSR() { cert, err := x509.CreateCertificate(rand.Reader, tpl, m.caCert, csr.PublicKey, m.caKey) fatalIfErr(err, "failed to generate certificate") + c, err := x509.ParseCertificate(cert) + fatalIfErr(err, "failed to parse generated certificate") var hosts []string - hosts = append(hosts, csr.DNSNames...) - hosts = append(hosts, csr.EmailAddresses...) - for _, ip := range csr.IPAddresses { + hosts = append(hosts, c.DNSNames...) + hosts = append(hosts, c.EmailAddresses...) + for _, ip := range c.IPAddresses { hosts = append(hosts, ip.String()) } - for _, uri := range csr.URIs { + for _, uri := range c.URIs { hosts = append(hosts, uri.String()) } certFile, _, _ := m.fileNames(hosts)