Skip to content

Commit

Permalink
print full subject and issuer, and print fingerprint
Browse files Browse the repository at this point in the history
  • Loading branch information
stuarthicks committed May 28, 2024
1 parent e67d97d commit e03ebc6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"crypto/sha1"
"crypto/tls"
"flag"
"fmt"
Expand Down Expand Up @@ -37,8 +38,9 @@ func main() {
for _, cert := range certs {
var sans = cert.DNSNames
sort.Strings(sans)
fmt.Printf("Issuer:\t\t%s\n", strings.Join(cert.Issuer.Organization, ", "))
fmt.Printf("Common Name:\t%s\n", cert.Subject.CommonName)
fmt.Printf("Fingerprint:\t%s\n", strings.ReplaceAll(fmt.Sprintf("SHA1=% X", sha1.Sum(cert.Raw)), " ", ":"))
fmt.Printf("Issuer:\t\t%s\n", cert.Issuer.String())
fmt.Printf("Subject:\t%s\n", cert.Subject.String())
fmt.Printf("Subject Alternative Names:\n")
for _, san := range sans {
fmt.Printf("\t%s\n", san)
Expand Down

0 comments on commit e03ebc6

Please sign in to comment.