Documentation
¶
Index ¶
- func EncodeCABundle(caCertPEM, caKeyPEM []byte) ([]byte, error)
- func EncodeClientBundle(caCertPEM, clientCertPEM, clientKeyPEM []byte) ([]byte, error)
- func EncodeServerBundle(caCertPEM, caKeyPEM, serverCertPEM, serverKeyPEM []byte, denylist []string) ([]byte, error)
- func FirstCertificateFromPEM(pemBytes []byte) (*x509.Certificate, error)
- func NormalizeSerials(serials []string) []string
- type Bundle
- type CA
- type ClientBundle
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeCABundle ¶
EncodeCABundle concatenates the CA certificate and private key into a PEM file.
func EncodeClientBundle ¶
EncodeClientBundle encodes a client PEM (CA cert + client cert + key).
func EncodeServerBundle ¶
func EncodeServerBundle(caCertPEM, caKeyPEM, serverCertPEM, serverKeyPEM []byte, denylist []string) ([]byte, error)
EncodeServerBundle encodes the server bundle components into PEM.
func FirstCertificateFromPEM ¶
func FirstCertificateFromPEM(pemBytes []byte) (*x509.Certificate, error)
FirstCertificateFromPEM returns the first certificate contained in pemBytes.
func NormalizeSerials ¶
NormalizeSerials lowercases, trims, de-duplicates, and sorts serials.
Types ¶
type Bundle ¶
type Bundle struct {
ServerCertificate tls.Certificate
ServerCert *x509.Certificate
ServerCertPEM []byte
ServerKeyPEM []byte
CACertificate *x509.Certificate
CACertPEM []byte
CAPrivateKey crypto.Signer
CAPrivateKeyPEM []byte
CAPool *x509.CertPool
Denylist map[string]struct{}
DenylistEntries []string
MetadataRootKey keymgmt.RootKey
MetadataDescriptor keymgmt.Descriptor
}
Bundle represents the parsed contents of a combined PEM bundle containing CA certificates, a server certificate, and the associated private key.
func LoadBundle ¶
LoadBundle parses a lockd server bundle from path, optionally applying a denylist of revoked serial numbers.
type CA ¶
type CA struct {
Cert *x509.Certificate
CertPEM []byte
Key ed25519.PrivateKey
KeyPEM []byte
}
CA holds a certificate authority keypair.
func CAFromBundle ¶
CAFromBundle constructs a CA helper from a parsed bundle.
func GenerateCA ¶
GenerateCA creates a new self-signed certificate authority.
func (*CA) IssueClient ¶
IssueClient issues a mutually-authenticated client certificate.
type ClientBundle ¶
type ClientBundle struct {
Certificate tls.Certificate
ClientCert *x509.Certificate
ClientCertPEM []byte
ClientKeyPEM []byte
CACerts []*x509.Certificate
CAPool *x509.CertPool
}
ClientBundle represents a parsed client PEM bundle containing CA certs and a client certificate+key pair suitable for building an mTLS HTTP client.
func LoadClientBundle ¶
func LoadClientBundle(path string) (*ClientBundle, error)
LoadClientBundle parses a client bundle from path.