pki

package
v0.0.27 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseCert

func ParseCert(bytes []byte) (*x509.Certificate, error)

func ValidCACert

func ValidCACert(keyPair *KeyPair, dnsName string, at time.Time) (bool, error)

func ValidCert

func ValidCert(caCert *x509.Certificate, certKeyPair *KeyPair, dnsName string, at time.Time) (bool, error)

Types

type KeyPair

type KeyPair struct {
	Cert    *x509.Certificate
	Key     *rsa.PrivateKey
	CertPEM []byte
	KeyPEM  []byte
}

func CreateCA

func CreateCA(x509Opts ...X509Opt) (*KeyPair, error)

func CreateCert

func CreateCert(caKeyPair *KeyPair, x509Opts ...X509Opt) (*KeyPair, error)

func KeyPairFromPEM

func KeyPairFromPEM(certPEM, keyPEM []byte) (*KeyPair, error)

func KeyPairFromTLSSecret

func KeyPairFromTLSSecret(secret *corev1.Secret) (*KeyPair, error)

func (*KeyPair) FillTLSSecret

func (k *KeyPair) FillTLSSecret(secret *corev1.Secret)

func (*KeyPair) IsValid

func (k *KeyPair) IsValid() bool

type X509Opt

type X509Opt func(*X509Opts)

func WithCommonName

func WithCommonName(name string) X509Opt

func WithDNSNames

func WithDNSNames(dnsNames []string) X509Opt

func WithNotAfter

func WithNotAfter(notAfter time.Time) X509Opt

func WithNotBefore

func WithNotBefore(notBefore time.Time) X509Opt

func WithOrganization

func WithOrganization(org string) X509Opt

type X509Opts

type X509Opts struct {
	CommonName   string
	DNSNames     []string
	Organization string
	NotBefore    time.Time
	NotAfter     time.Time
}

Jump to

Keyboard shortcuts

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