cert

package
v0.13.6 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCertificateFromBytes

func GetCertificateFromBytes(raw []byte) (*x509.Certificate, error)

func GetCertificateWithPrivateKeyFromBytes

func GetCertificateWithPrivateKeyFromBytes(certBytes, keyBytes []byte) (*x509.Certificate, *rsa.PrivateKey, error)

func GetPrivateKeyFromBytes

func GetPrivateKeyFromBytes(raw []byte) (*rsa.PrivateKey, error)

func IPsToStrings added in v0.13.2

func IPsToStrings(ips []net.IP) []string

func ValidateCertificate

func ValidateCertificate(cert *x509.Certificate, key *rsa.PrivateKey, expirationThreshold time.Duration) error

Types

type CA

type CA interface {
	GenerateCertificate(opts CertificateOptions) (certificatePem *bytes.Buffer, certificateKey *bytes.Buffer, err error)
	CACertificatePem() (b *bytes.Buffer, err error)
	CAPrivateKeyPem() (b *bytes.Buffer, err error)
	ExpiresIn(now time.Time) (time.Duration, error)
	ValidateCert(certificate *x509.Certificate) error
}

type CapsuleCA

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

func GenerateCertificateAuthority

func GenerateCertificateAuthority() (s *CapsuleCA, err error)

func NewCertificateAuthorityFromBytes

func NewCertificateAuthorityFromBytes(certBytes, keyBytes []byte) (*CapsuleCA, error)

func (CapsuleCA) CACertificatePem

func (c CapsuleCA) CACertificatePem() (b *bytes.Buffer, err error)

func (CapsuleCA) CAPrivateKeyPem

func (c CapsuleCA) CAPrivateKeyPem() (b *bytes.Buffer, err error)

func (*CapsuleCA) ExpiresIn

func (c *CapsuleCA) ExpiresIn(now time.Time) (time.Duration, error)

func (*CapsuleCA) GenerateCertificate

func (c *CapsuleCA) GenerateCertificate(opts CertOpts) (certificatePem *bytes.Buffer, certificateKey *bytes.Buffer, err error)

func (*CapsuleCA) ValidateCert

func (c *CapsuleCA) ValidateCert(certificate *x509.Certificate) error

type CertOpts added in v0.13.2

type CertOpts struct {
	SAN            CertificateSANs
	ExpirationDate time.Time
}

func NewCertOpts

func NewCertOpts(expirationDate time.Time, sans CertificateSANs) CertOpts

func (CertOpts) GetDNSNames added in v0.13.2

func (c CertOpts) GetDNSNames() CertificateSANs

func (CertOpts) GetExpirationDate added in v0.13.2

func (c CertOpts) GetExpirationDate() time.Time

type CertificateOptions

type CertificateOptions interface {
	GetDNSNames() CertificateSANs
	GetExpirationDate() time.Time
}

type CertificateSANs added in v0.13.2

type CertificateSANs struct {
	DNSNames []string
	IPAddrs  []net.IP
}

func (*CertificateSANs) AddDNSNames added in v0.13.2

func (s *CertificateSANs) AddDNSNames(names ...string)

func (*CertificateSANs) AddIPAddrs added in v0.13.2

func (s *CertificateSANs) AddIPAddrs(ips ...net.IP)

func (*CertificateSANs) AddServiceReference added in v0.13.2

func (s *CertificateSANs) AddServiceReference(
	service *admissionregistrationv1.ServiceReference,
	defaultNamespace string,
)

func (*CertificateSANs) AddURL added in v0.13.2

func (s *CertificateSANs) AddURL(rawURL *string) error

func (CertificateSANs) Empty added in v0.13.2

func (s CertificateSANs) Empty() bool

func (CertificateSANs) MatchesCertificate added in v0.13.2

func (s CertificateSANs) MatchesCertificate(certificate *x509.Certificate) bool

func (CertificateSANs) Normalize added in v0.13.2

func (s CertificateSANs) Normalize() CertificateSANs

Jump to

Keyboard shortcuts

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