Help us shape the future of Go! Take the 2026 Go Developer Survey

cert

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: May 29, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCertificateFromBytes

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

func GetCertificateWithPrivateKeyFromBytes

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

func GetPrivateKeyFromBytes

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

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 CertificateOptions) (certificatePem *bytes.Buffer, certificateKey *bytes.Buffer, err error)

func (*CapsuleCA) ValidateCert

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

type CertificateOptions

type CertificateOptions interface {
	DNSNames() []string
	ExpirationDate() time.Time
}

func NewCertOpts

func NewCertOpts(expirationDate time.Time, dnsNames ...string) CertificateOptions

Jump to

Keyboard shortcuts

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