Skip to content

Commit c54b0ae

Browse files
author
David Wu
committed
Using the Subject.String() instead of Subject.CommonName for the heading of the PEM certificates in the info output
1 parent 8bf4486 commit c54b0ae

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cert/command/info/info_result.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func (result *Result) Out() {
6161

6262
// Top level result Root Certificates actually don't have a trust chain, so we'll have to print it here
6363
if cert.IsRootCert() && !result.hidePEMOutput {
64-
fmt.Printf("\n\tRoot CA Certificate - "+cert.Certificate.Subject.CommonName+":\n\n%s\n\n", result.dos2unixString(string(*cert.PemBlock)))
64+
fmt.Printf("\n\tRoot CA Certificate - "+cert.Certificate.Subject.String()+":\n\n%s\n\n", result.dos2unixString(string(*cert.PemBlock)))
6565
}
6666

6767
var sb = strings.Builder{}
@@ -103,11 +103,11 @@ func (result *Result) Out() {
103103
for _, cert = range chain {
104104
if cert.Type == certificate.TypeServerCertificate ||
105105
cert.Type == certificate.TypeSelfSignedServerCertificate {
106-
sb.WriteString("Server Certificate - " + cert.Certificate.Subject.CommonName + ":\n\n")
106+
sb.WriteString("Server Certificate - " + cert.Certificate.Subject.String() + ":\n\n")
107107
} else if cert.Type == certificate.TypeIntermediateCertificate {
108-
sb.WriteString("Intermediate Certificate - " + cert.Certificate.Subject.CommonName + ":\n\n")
108+
sb.WriteString("Intermediate Certificate - " + cert.Certificate.Subject.String() + ":\n\n")
109109
} else {
110-
sb.WriteString("Root CA Certificate - " + cert.Certificate.Subject.CommonName + ":\n\n")
110+
sb.WriteString("Root CA Certificate - " + cert.Certificate.Subject.String() + ":\n\n")
111111
}
112112

113113
// This caters for the case if the certificate was actually a system root certificate

0 commit comments

Comments
 (0)