Skip to content

Commit

Permalink
initial working version with extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
pete911 committed Dec 16, 2024
1 parent 635941e commit 3e95bab
Show file tree
Hide file tree
Showing 9 changed files with 559 additions and 171 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ certinfo [flags] [<file>|<host:port> ...]
| -chains | whether to print verified chains as well (only applicable for host) |
| -clipboard | read input from clipboard (only if the clipboard is supported) |
| -expiry | print expiry of certificates |
| -extensions | whether to print extensions
| -insecure | whether a client verifies the server's certificate chain and host name (only applicable for host) |
| -issuer-like | print certificates with subject field containing supplied string |
| -no-duplicate | do not print duplicate certificates |
Expand Down
3 changes: 3 additions & 0 deletions flag.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type Flags struct {
IssuerLike string
Insecure bool
Chains bool
Extensions bool
Pem bool
PemOnly bool
Version bool
Expand Down Expand Up @@ -46,6 +47,8 @@ func ParseFlags() (Flags, error) {
"whether a client verifies the server's certificate chain and host name (only applicable for host)")
flagSet.BoolVar(&flags.Chains, "chains", getBoolEnv("CERTINFO_CHAINS", false),
"whether to print verified chains as well (only applicable for host)")
flagSet.BoolVar(&flags.Extensions, "extensions", getBoolEnv("CERTINFO_EXTENSIONS", false),
"whether to print extensions")
flagSet.BoolVar(&flags.Pem, "pem", getBoolEnv("CERTINFO_PEM", false),
"whether to print pem as well")
flagSet.BoolVar(&flags.PemOnly, "pem-only", getBoolEnv("CERTINFO_PEM_ONLY", false),
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func main() {
PrintPemOnly(certificatesFiles, flags.Chains)
return
}
PrintCertificatesLocations(certificatesFiles, flags.Chains, flags.Pem)
PrintCertificatesLocations(certificatesFiles, flags.Chains, flags.Pem, flags.Extensions)
}

func LoadCertificatesLocations(flags Flags) cert.CertificateLocations {
Expand Down
Loading

0 comments on commit 3e95bab

Please sign in to comment.