certificate

package
v0.6.2 Latest Latest
Warning

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

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

Documentation

Overview

Package certificate provides facilities for working with certificates.

Index

Constants

This section is empty.

Variables

View Source
var ErrFailedToDecodeKey = errors.New("unable to decode private key")

ErrFailedToDecodeKey indicates that the private key could not be decoded.

Functions

func GenerateCRL added in v0.5.0

func GenerateCRL(ca *KeyPair) ([]byte, error)

GenerateCRL will generate a blank Certificate revocation List from the provided issuer certificate.

Types

type HostNames

type HostNames []string

HostNames contains the list of hosts the cert will be generated for.

func (*HostNames) Set

func (h *HostNames) Set(value string) error

Set will add the hostname to the hostname array.

func (*HostNames) String

func (h *HostNames) String() string

type KeyPair

type KeyPair struct {
	Certificate []byte
	PrivateKey  []byte
}

KeyPair stores a PEM encoded certificate and a PEM encoded RSA private key.

func GenerateCA

func GenerateCA() (*KeyPair, error)

GenerateCA will generate a new CA key/cert pair.

func GenerateSignedCert

func GenerateSignedCert(ca *KeyPair, hostnames HostNames, commonName string) (*KeyPair, error)

GenerateSignedCert will generate a new signed certificate signed by the input CA key/cert pair with one of multiple hostnames and with the given CN.

func GenerateSignedCertFromFiles added in v0.6.0

func GenerateSignedCertFromFiles(caCertFile string, caKeyFile string,
	hostnames HostNames, commonName string,
) (*KeyPair, error)

GenerateSignedCertFromFiles generates a new signed certificate signed by the input CA key/cert pair.

Jump to

Keyboard shortcuts

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