Documentation
¶
Overview ¶
Package print writes human-readable descriptions of certificates, certificate requests, CRLs and OCSP responses to an io.Writer, and a JSON helper for CLI output. Timestamps are printed in local time; write errors are ignored by design because the output is for humans.
Extensions prints X.509 extensions as a YAML list in the syntax of the extensions of a certificate profile (csr.X509Extension), with the values decoded by the types of the oid package:
print.Certificate(os.Stdout, crt, true)
Extensions:
- id: 1.3.6.1.5.5.7.1.26 # TN Auth List
critical: false
content:
- spc: 969H
- id: 1.3.999.1
critical: false
value: hex:0500
An extension without a registered type, or with a value that does not decode, is printed as the hex of its DER.
Index ¶
- func CertAndKey(w io.Writer, key, csrBytes, cert []byte)
- func Certificate(w io.Writer, crt *x509.Certificate, verboseExtensions bool)
- func CertificateList(w io.Writer, crl *x509.RevocationList)
- func CertificateRequest(w io.Writer, crt *x509.CertificateRequest)
- func Certificates(w io.Writer, list []*x509.Certificate, verboseExtensions bool)
- func Extensions(w io.Writer, list []pkix.Extension)
- func JSON(w io.Writer, v any)
- func OCSPResponse(w io.Writer, res *ocsp.Response, verboseExtensions bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CertAndKey ¶
CertAndKey outputs a cert, key and csr
func Certificate ¶
func Certificate(w io.Writer, crt *x509.Certificate, verboseExtensions bool)
Certificate prints cert details. With verboseExtensions it also prints every extension, decoded when the oid package has a type for it (see Extensions).
func CertificateList ¶
func CertificateList(w io.Writer, crl *x509.RevocationList)
CertificateList prints CRL details
func CertificateRequest ¶
func CertificateRequest(w io.Writer, crt *x509.CertificateRequest)
CertificateRequest prints cert request details, with the requested extensions decoded as Extensions does.
func Certificates ¶
func Certificates(w io.Writer, list []*x509.Certificate, verboseExtensions bool)
Certificates prints list of cert details
func Extensions ¶ added in v2.0.333
Extensions prints X.509 extensions as a YAML list in the form of the extensions of a certificate profile: the id with the registered name as a comment, the critical flag, and the content decoded by the type the oid package has for the extension. An extension without a type, or with a value that does not decode, is printed with its DER in hex. Content that encodes to other bytes than the extension has (a value that is not DER, or that has other string types than this module writes) has the original bytes in a comment.
Types ¶
This section is empty.