ca

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authority

type Authority struct {
	Cert    *x509.Certificate
	Key     *ecdsa.PrivateKey
	TLSCert tls.Certificate
}

Authority holds a CA certificate and private key used to sign leaf certificates.

func GenerateToPath

func GenerateToPath(certPath, keyPath string) (*Authority, error)

GenerateToPath creates a new CA and writes it to disk. Returns the Authority.

func LoadOrGenerate

func LoadOrGenerate(certPath, keyPath string) (*Authority, error)

LoadOrGenerate loads an existing CA from disk, or generates a new one if the files don't exist.

type CertCache

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

CertCache generates and caches TLS leaf certificates signed by a CA.

func NewCertCache

func NewCertCache(ca *Authority) *CertCache

NewCertCache creates a certificate cache backed by the given CA.

func (*CertCache) GetCertificate

func (cc *CertCache) GetCertificate(hello *tls.ClientHelloInfo) (*tls.Certificate, error)

GetCertificate returns a TLS certificate for the given ClientHello. This matches the tls.Config.GetCertificate signature.

Jump to

Keyboard shortcuts

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