pki

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendBundle

func AppendBundle(bundlePath string, certPaths ...string) error

AppendBundle appends PEM certificate files to an existing trust bundle file.

func BuildBundle

func BuildBundle(outPath string, certPaths ...string) error

BuildBundle concatenates multiple PEM certificate files into a single trust bundle.

func CrossSign

func CrossSign(signerCert *x509.Certificate, signerKey *ecdsa.PrivateKey, targetCert *x509.Certificate, outPath string) error

CrossSign takes a target CA certificate and re-signs it using the signer CA, creating a cross-signed certificate that chains to the signer's trust root.

func GenerateJWTKeypair

func GenerateJWTKeypair(outDir, baseName string) (pubPath, privPath string, err error)

GenerateJWTKeypair creates an Ed25519 keypair for JWT signing.

func InitCA

func InitCA(name, outDir string) (certPath, keyPath string, err error)

InitCA generates a new ECDSA P-384 CA keypair and self-signed certificate.

func IssueCert

func IssueCert(caCert *x509.Certificate, caKey *ecdsa.PrivateKey, ct CertType, cn string, sans []string, outDir string, validity time.Duration) (certPath, keyPath string, err error)

IssueCert generates a new ECDSA P-384 keypair and certificate signed by the given CA. When validity is zero or negative the default (90 days) is used.

func LoadCA

func LoadCA(certPath, keyPath string) (*x509.Certificate, *ecdsa.PrivateKey, error)

LoadCA loads a CA certificate and private key from PEM files.

func LoadCert

func LoadCert(path string) (*x509.Certificate, error)

LoadCert loads a certificate from a PEM file.

func LoadEd25519PrivateKey

func LoadEd25519PrivateKey(path string) (ed25519.PrivateKey, error)

LoadEd25519PrivateKey loads an Ed25519 private key from a PEM file.

func LoadEd25519PublicKey

func LoadEd25519PublicKey(path string) (ed25519.PublicKey, error)

LoadEd25519PublicKey loads an Ed25519 public key from a PEM file.

func NewCertPoolFromPEM

func NewCertPoolFromPEM(pemData []byte) *x509.CertPool

NewCertPoolFromPEM creates a cert pool from PEM-encoded certificate data.

func VerifyOpts

func VerifyOpts(roots *x509.CertPool) x509.VerifyOptions

VerifyOpts returns x509 verify options using the given root pool.

func WritePublicKeyPEM

func WritePublicKeyPEM(path string, pubKey ed25519.PublicKey) error

WritePublicKeyPEM writes an Ed25519 public key to a PEM file.

Types

type CertType

type CertType int

CertType indicates whether to issue a server or client certificate.

const (
	CertTypeServer CertType = iota
	CertTypeClient
)

Jump to

Keyboard shortcuts

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