Documentation ¶
Index ¶
- func DecodePEMCertificates(crtb []byte) ([]*x509.Certificate, error)
- func DecodePEMCertificatesChain(crtb []byte) ([]*x509.Certificate, error)
- func DecodePEMPrivateKey(key []byte) (crypto.Signer, error)
- func EncodePrivateKey(key any) ([]byte, error)
- func EncodeX509(cert *x509.Certificate) ([]byte, error)
- func EncodeX509Chain(certs []*x509.Certificate) ([]byte, error)
- func PublicKeysEqual(a, b crypto.PublicKey) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodePEMCertificates ¶
func DecodePEMCertificates(crtb []byte) ([]*x509.Certificate, error)
DecodePEMCertificatesChain takes a PEM-encoded x509 certificates byte array and returns all certificates in a slice of x509.Certificate objects.
func DecodePEMCertificatesChain ¶
func DecodePEMCertificatesChain(crtb []byte) ([]*x509.Certificate, error)
DecodePEMCertificatesChain takes a PEM-encoded x509 certificates byte array and returns all certificates in a slice of x509.Certificate objects. Expects certificates to be a chain with leaf certificate to be first in the byte array.
func DecodePEMPrivateKey ¶
DecodePEMPrivateKey takes a key PEM byte array and returns an object that represents either an RSA or EC private key.
func EncodePrivateKey ¶
EncodePrivateKey will encode a private key into PEM format.
func EncodeX509 ¶
func EncodeX509(cert *x509.Certificate) ([]byte, error)
EncodeX509 will encode a single *x509.Certificate into PEM format.
func EncodeX509Chain ¶
func EncodeX509Chain(certs []*x509.Certificate) ([]byte, error)
EncodeX509Chain will encode a list of *x509.Certificates into a PEM format chain. Self-signed certificates are not included as per https://datatracker.ietf.org/doc/html/rfc5246#section-7.4.2 Certificates are output in the order they're given; if the input is not ordered as specified in RFC5246 section 7.4.2, the resulting chain might not be valid for use in TLS.
func PublicKeysEqual ¶
PublicKeysEqual compares two given public keys for equality. The definition of "equality" depends on the type of the public keys. Returns true if the keys are the same, false if they differ or an error if the key type of `a` cannot be determined.
Types ¶
This section is empty.