cert

package
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Split

func Split(pemData []byte) (key, cert []byte)

Split returns a separate byte slice for the key and certificate chain from a single combined input

Types

type Certificate

type Certificate struct {
	Certificate *tls.Certificate
	Leaf        *x509.Certificate
	Chain       []*x509.Certificate
	RawKey      []byte
	RawCert     []byte
}

Certificate holds the parsed and the PEM-encoded raw key & cert

func Load

func Load(key []byte, cert []byte) (*Certificate, error)

Load returns a certificate from a key- and certificate chain byte slice

func LoadFromDisk

func LoadFromDisk(keyFile string, certFile string) (*Certificate, error)

LoadFromDisk returns a certificate loaded from a key- and certificate chain file

func (*Certificate) ChainPEM

func (c *Certificate) ChainPEM() []byte

ChainPEM returns the raw certificate chain certificates as a pem encoded byte slice

func (*Certificate) Fingerprint

func (c *Certificate) Fingerprint() string

Fingerprint returns the sha256 fingerprint of the leaf certificate

func (*Certificate) FullPEM

func (c *Certificate) FullPEM() []byte

FullPEM returns the full certificate chain and private key as a pem encoded byte slice

func (*Certificate) LeafPEM

func (c *Certificate) LeafPEM() []byte

LeafPEM returns the raw leaf cert as a pem encoded byte slice

func (*Certificate) NotAfter

func (c *Certificate) NotAfter() time.Time

NotAfter returns the expire date of the leaf certificate

func (*Certificate) PublicKeyAlgorithm

func (c *Certificate) PublicKeyAlgorithm() string

PublicKeyAlgorithm returns the public key algorithm of the leaf certificate

func (*Certificate) String

func (c *Certificate) String() string

String returns the private key concatenated with the whole certificate chain as a PEM-encoded string

func (*Certificate) SubjectCN

func (c *Certificate) SubjectCN() string

SubjectCN returns the subject CN of the leaf certificate

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL