certs

package
v0.0.0-...-ec11375 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2018 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterExpiredCerts

func FilterExpiredCerts(certs ...*x509.Certificate) []*x509.Certificate

FilterExpiredCerts checks are all certificates in the bundle valid, i.e. they have not expired. The function returns new bundle with only valid certificates or error if no valid certificate is found.

Types

type Certificate

type Certificate struct {
	Certificates []*x509.Certificate
	Key          crypto.PrivateKey
}

Certificate contains slice of certificates and a key.

func NewCACertificate

func NewCACertificate(subject pkix.Name, serialNumber int64, validity metav1.Duration, currentTime func() time.Time) (*Certificate, error)

NewCACertificate generates and signs new CA certificate and key.

func ParseCertificateBytes

func ParseCertificateBytes(certBytes, keyBytes []byte) (*Certificate, error)

ParseCertificateBytes converts PEM formatted certificate to the Certificate struct. Key is allowed to be empty, as there is cases when we're not storing it (e.g. CA bundles).

func (*Certificate) GetPEMBytes

func (c *Certificate) GetPEMBytes() ([]byte, []byte, error)

GetPEMBytes converts x509-formatted Certificate and Key to the PEM bytes. Key is allowed to be empty because we may not have a key (e.g. CA bundles).

func (*Certificate) NewClientCertificate

func (c *Certificate) NewClientCertificate(subject pkix.Name, serialNumber int64, validity metav1.Duration, currentTime func() time.Time) (*Certificate, error)

NewClientCertificate generates and signs new Client certificate and key from server certificate..

func (*Certificate) NewServerCertificate

func (c *Certificate) NewServerCertificate(subject pkix.Name, hosts []string, serialNumber int64, validity metav1.Duration, currentTime func() time.Time) (*Certificate, error)

NewServerCertificate generates and signs new Server certificate and key from CA bundle.

Jump to

Keyboard shortcuts

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