cert

package
v0.0.0-...-4982f92 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyExt  = ".key"
	CertExt = ".crt"
)

Variables

This section is empty.

Functions

func LoadFromDisk

func LoadFromDisk(pkiPath, name string) (*x509.Certificate, crypto.Signer, error)

func NewKey

func NewKey(algorithm string, bits int) (crypto.Signer, error)

NewKey return a new private key

func NewSelfSignedCACert

func NewSelfSignedCACert(cfg *Config, key crypto.Signer) (*x509.Certificate, error)

NewSelfSignedCACert creates a self-signed CA certificate respecting the validity duration configured in cfg. If cfg.ValidFor is zero, a default of one year is used.

func ParseDuration

func ParseDuration(s string) (time.Duration, error)

ParseDuration converts a human-friendly duration string into a time.Duration. It supports the suffixes "y" for years (365 days) and "d" for days in addition to the standard time.ParseDuration formats like "720h" or "15m".

func WriteToDisk

func WriteToDisk(pkiPath, name string, certs []*x509.Certificate, key crypto.Signer) error

Types

type Config

type Config struct {
	certutil.Config

	Name string
	Dir  string

	Bits     int
	ValidFor time.Duration
}

Jump to

Keyboard shortcuts

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