certauth

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2026 License: CC0-1.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateCSR

func GenerateCSR(cn string) (csrPEM []byte, keyPEM []byte, err error)

GenerateCSR creates a new EC P-256 private key and a certificate signing request with the given common name. Both are returned PEM-encoded.

func ParseCertPEM

func ParseCertPEM(pemData []byte) (*x509.Certificate, error)

ParseCertPEM decodes a PEM block and parses the contained x509 certificate.

Types

type CA

type CA struct {
	Cert *x509.Certificate
	Key  crypto.PrivateKey
}

CA holds a certificate authority's certificate and private key, used to sign client certificates for mTLS authentication.

func LoadOrCreateCA

func LoadOrCreateCA(dir string) (*CA, error)

LoadOrCreateCA loads an existing CA from dir, or creates a new one if ca.key and ca.crt do not exist yet.

func (*CA) CertPEM

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

CertPEM returns the CA certificate as a PEM-encoded block.

func (*CA) SignCSR

func (ca *CA) SignCSR(csrPEM []byte) ([]byte, error)

SignCSR parses a PEM-encoded certificate signing request, verifies its signature, and returns a PEM-encoded client certificate signed by this CA.

Jump to

Keyboard shortcuts

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