https://github.com/zmap/zcertificate
Command line utility for parsing certificates
https://github.com/zmap/zcertificate
Last synced: 11 months ago
JSON representation
Command line utility for parsing certificates
- Host: GitHub
- URL: https://github.com/zmap/zcertificate
- Owner: zmap
- License: apache-2.0
- Created: 2017-05-10T20:23:22.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2021-02-17T23:03:07.000Z (over 5 years ago)
- Last Synced: 2024-06-18T14:08:46.797Z (about 2 years ago)
- Language: Go
- Size: 1.67 MB
- Stars: 57
- Watchers: 19
- Forks: 18
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ZCertificate
[](https://github.com/zmap/zcertificate/actions?query=workflow%3AGo)
[](https://github.com/zmap/zcertificate/actions?query=workflow%3Agolangci-lint)
ZCertificate parses X.509 certificates and runs [ZLint](https://github.com/zmap/zlint).
### Installing ZCertificate
1. Pick a [ZCertificate release][releases] and download the `.tar.gz` archive for
your architecture (for example `Linux_x86_64.tar.gz`):
wget https://github.com/zmap/zcertificate/releases/download/v0.0.1/zcertificate_0.0.1_Linux_x86_64.tar.gz
1. Extract the archive and change into the extracted directory:
tar xf zcertificate*.tar.gz
cd zcertificate*
1. Make the `zcertificate` program executable:
chmod +x zcertificate
1. Run the `zcertificate` program:
./zcertificate
[releases]: https://github.com/zmap/zcertificate/releases
### Building from source
Building ZCertificate from source requires [Go 1.16.x or
newer](https://golang.org/doc/install).
Assuming the `go` command is in your `$PATH` you can build ZCertificate from
source with:
```bash
go get github.com/zmap/zcertificate/cmd/zcertificate
```
### Usage
```
$ ./zcertificate --help
Usage of ./zcertificate:
-fatal-parse-errors
Halt if a certificate cannot be parsed. Default is to log.
-json-parse-errors
Output json if a certificate cannot be parsed. Default is not to.
-format string
one of {pem, base64} (default "pem")
-output-file string
Specifies file path for the output JSON. (default "-")
-procs int
Specifies number of processes to run on. Default is 0, meaning use current value of $GOMAXPROCS.
-workers int
Specifies number of goroutines to use to parse and lint certificates. (default 1)
$ cat example.crt | zcertificate | jq .
INFO[0000] reading from stdin
INFO[0000] writing to stdout
{
"raw": "...",
"parsed": {
"version": 3,
"serial_number": "513",
"signature_algorithm": {
"name": "SHA1WithRSA",
"oid": "1.2.840.113549.1.1.5"
},
"issuer": {
"country": [
"US"
],
...
}
```