tls

package
v0.0.0-...-5fa7f0c Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cert

type Cert interface {
	SecretDataCA() map[string][]byte
	SecretData(ca Cert) map[string][]byte
	KeyData() []byte
	CertData() []byte
	CreateAndSignCertificate(commonName string, orgUnit string, dnsnames []string) (cert Cert, err error)
}

type CertValidater

type CertValidater interface {
	IsExpiringSoon() bool
	IsSignedByCA(ca Cert) (bool, error)
}

func NewCertValidater

func NewCertValidater(pemData []byte, opts ...ImplCertValidaterOption) (CertValidater, error)

type ImplCertValidaterOption

type ImplCertValidaterOption func(*implCertValidaterOptions)

func WithExpiryThreshold

func WithExpiryThreshold(expiryThreshold time.Duration) ImplCertValidaterOption

type PEMCert

type PEMCert struct {
	// contains filtered or unexported fields
}

Represents a certificate with key

func (*PEMCert) CertData

func (cert *PEMCert) CertData() []byte

func (*PEMCert) CreateAndSignCertificate

func (ca *PEMCert) CreateAndSignCertificate(commonName string, orgUnit string, dnsnames []string) (cert Cert, err error)

func (*PEMCert) KeyData

func (cert *PEMCert) KeyData() []byte

func (*PEMCert) SecretData

func (cert *PEMCert) SecretData(ca Cert) map[string][]byte

func (*PEMCert) SecretDataCA

func (ca *PEMCert) SecretDataCA() map[string][]byte

type PKI

type PKI interface {
	GenerateCA(name string) (ca Cert, err error)
	CAFromSecret(data map[string][]byte) Cert
}

func NewPKI

func NewPKI() PKI

type PkiImpl

type PkiImpl struct {
}

Dummy struct so that PKI interface can be implemented for easier mocking in tests

func (*PkiImpl) CAFromSecret

func (pki *PkiImpl) CAFromSecret(data map[string][]byte) Cert

func (*PkiImpl) GenerateCA

func (pki *PkiImpl) GenerateCA(name string) (ca Cert, err error)

Jump to

Keyboard shortcuts

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