keygen

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: BSD-2-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCertName     = "cert.pem"
	DefaultRootCertName = "rootcert.pem"
	DefaultKeyName      = "key.pem"
	DefaultRootKeyName  = "rootkey.pem"
)

Variables

View Source
var (
	ErrNoRootCert = errors.New("missing rootCert")
	ErrNoRootKey  = errors.New("missing rootKey")
)
View Source
var (
	ErrNoPEMBlock = errors.New("no PEM block found")
	ErrTrailing   = errors.New("unexpected trailing data after PEM block")
)

Functions

func Certificate

func Certificate(args *CertificateArgs) error

Certificate is used to create a new certificate and private key to sign OS packages with.

func LoadCertBytes added in v0.3.1

func LoadCertBytes(path string) ([]byte, error)

Loads a PEM coded x509 certificate, without decoding the DER blob.

func LoadPrivateKey added in v0.3.1

func LoadPrivateKey(fileName string) (crypto.Signer, error)

Loads a private key file, either x509 style, or an OpenSSH public key file where private key is accessed using ssh-agent.

func LoadPublicKey added in v0.3.1

func LoadPublicKey(fileName string) (crypto.PublicKey, error)

func WritePEM

func WritePEM(block *pem.Block, path string) error

WritePEM writes the pem.Block data to a PEM formatted file to the specified path.

Types

type CertificateArgs

type CertificateArgs struct {
	IsCa           bool
	IssuerCertFile string // Empty, for creating a self-signed cert.
	IssuerKeyFile  string // Private root CA signing key.
	LeafKeyFile    string // Public key
	NotBefore      time.Time
	NotAfter       time.Time
	CertOut        string
	KeyOut         string
}

CertificateArgs is a list of arguments that's passed to Certificate().

Jump to

Keyboard shortcuts

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