Skip to content

Commit 903b96d

Browse files
committed
Add certificate fingerprint display in inspection output
1 parent 4821c66 commit 903b96d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

cmd/inspect.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ package cmd
44

55
import (
66
"context"
7+
"encoding/hex"
78
"fmt"
89

910
"github.com/fatih/color"
@@ -60,7 +61,8 @@ Partial certificates are also all printed for further inspection.
6061
notes := analyser.AnalyseCertificate(cert.Certificate)
6162
if len(notes) > 0 {
6263
numIssues++
63-
fmt.Printf("Certificate %s\n", cert.Certificate.Subject)
64+
fingerprint := hex.EncodeToString(cert.FingerprintSha256[:])
65+
fmt.Printf("Certificate %s, Fingerprint: %s\n", cert.Certificate.Subject, fingerprint)
6466
for i, n := range notes {
6567
var lead string
6668
if i == len(notes)-1 {
@@ -85,7 +87,7 @@ Partial certificates are also all printed for further inspection.
8587
if len(parsedCertificates.Partials) > 0 {
8688
for _, p := range parsedCertificates.Partials {
8789
fmtFn := color.New(color.FgYellow).SprintfFunc()
88-
fmt.Printf(fmtFn("⚠️ Partial certificate found in file %s: %s\n", p.Location, p.Reason))
90+
fmt.Print(fmtFn("⚠️ Partial certificate found in file %s: %s\n", p.Location, p.Reason))
8991
}
9092
fmt.Printf("Found %d partial certificates\n", len(parsedCertificates.Partials))
9193
}

0 commit comments

Comments
 (0)