pki

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CertPoolFromPEM

func CertPoolFromPEM(caPEM []byte) (*x509.CertPool, error)

func Fingerprint

func Fingerprint(cert *x509.Certificate) string

func FingerprintPEM

func FingerprintPEM(certPEM []byte) (string, error)

FingerprintPEM parses a PEM certificate and returns its fingerprint.

func ValidateFingerprint added in v0.3.0

func ValidateFingerprint(s string) error

ValidateFingerprint checks that s is a well-formed certificate fingerprint: the "SHA256:" prefix followed by base64 of exactly 32 bytes, matching the form Fingerprint produces.

func WritePEM

func WritePEM(path string, data []byte) error

Types

type CA

type CA struct {
	Cert *x509.Certificate
	Key  ed25519.PrivateKey
	// contains filtered or unexported fields
}

func CreateCA

func CreateCA() (*CA, error)

func LoadCA

func LoadCA(certPEM, keyPEM []byte) (*CA, error)

func (*CA) CertPEM

func (ca *CA) CertPEM() []byte

func (*CA) IssueClient

func (ca *CA) IssueClient(name string) ([]byte, []byte, error)

func (*CA) IssueServer

func (ca *CA) IssueServer(host string) ([]byte, []byte, error)

func (*CA) KeyPEM

func (ca *CA) KeyPEM() []byte

Jump to

Keyboard shortcuts

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