caauth

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadCertificate

func LoadCertificate(certPEM []byte) (*x509.Certificate, error)

Types

type Authority

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

Authority represents a Certificate Authority

func LoadFromPEM

func LoadFromPEM(certPEM, keyPEM []byte) (*Authority, error)

LoadFromPEM loads an existing CA from PEM-encoded certificate and key

func New

func New(opts Options) (*Authority, error)

New creates a new CA with a self-signed certificate

func (*Authority) ExportPEM

func (ca *Authority) ExportPEM() (certPEM, keyPEM []byte, err error)

ExportPEM exports the CA certificate and private key in PEM format

func (*Authority) Fingerprint

func (ca *Authority) Fingerprint() string

func (*Authority) GetCACertificate

func (ca *Authority) GetCACertificate() []byte

GetCACertificate returns the CA certificate in PEM format

func (*Authority) IssueCertificate

func (ca *Authority) IssueCertificate(opts Options) (*ClientCertificate, error)

IssueCertificate creates a new certificate signed by the CA

func (*Authority) VerifyCertificate

func (ca *Authority) VerifyCertificate(certPEM []byte) error

VerifyCertificate verifies if a certificate was signed by this CA

type ClientCertificate

type ClientCertificate struct {
	CertPEM []byte
	KeyPEM  []byte
	CACert  []byte
}

func (*ClientCertificate) MarshalText

func (c *ClientCertificate) MarshalText() ([]byte, error)

func (*ClientCertificate) UnmarshalText

func (cert *ClientCertificate) UnmarshalText(data []byte) error

type Options

type Options struct {
	CommonName   string
	Organization string
	Country      string
	ValidFor     time.Duration

	DNSNames []string
	IPs      []net.IP
}

Options for certificate generation

Jump to

Keyboard shortcuts

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