cert

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 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 CaExpiredError

type CaExpiredError struct{}

func (CaExpiredError) Error

func (CaExpiredError) Error() string

type CaNotYetValidError

type CaNotYetValidError struct{}

func (CaNotYetValidError) Error

func (CaNotYetValidError) Error() string

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) GenerateCertificate

func (c *CapsuleCA) GenerateCertificate(opts CertificateOptions) (certificatePem *bytes.Buffer, certificateKey *bytes.Buffer, err 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