lib

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// CertValidity 5 years in hours
	CertValidity = 5 * 365 * 24
)

Functions

func GeneratePrivateKeyAndSerialNumber

func GeneratePrivateKeyAndSerialNumber() (*rsa.PrivateKey, *big.Int, error)

GeneratePrivateKeyAndSerialNumber generates a private key and serial number

func GenerateSerialNumber

func GenerateSerialNumber() (*big.Int, error)

GenerateSerialNumber creates a serial number.

Types

type TestCertAndKey

type TestCertAndKey struct {
	CertFile string
	KeyFile  string
	Cert     *x509.Certificate
	// contains filtered or unexported fields
}

TestCertAndKey is a struct to store cert info.

func GenerateClientTestKeyAndCert

func GenerateClientTestKeyAndCert(commonName string, parent *TestCertAndKey) (*TestCertAndKey, error)

GenerateClientTestKeyAndCert generates a test client cert/key given a signing CA

func GenerateClientTestKeyAndCertWithDate

func GenerateClientTestKeyAndCertWithDate(commonName string, parent *TestCertAndKey, notBefore time.Time) (*TestCertAndKey, error)

GenerateClientTestKeyAndCertWithDate generates a test client cert/key given a signing CA give a start date

func GenerateClientTestKeyAndCertWithOU

func GenerateClientTestKeyAndCertWithOU(commonName, organization, organizationalUnit string, parent *TestCertAndKey) (*TestCertAndKey, error)

GenerateClientTestKeyAndCertWithOU generates a test client cert/key given a signing CA

func GenerateRootSigningCert

func GenerateRootSigningCert(commonName string, organizationalUnit []string) (*TestCertAndKey, error)

GenerateRootSigningCert generates cert and key for a signing CA

func GenerateServerTestKeyAndCert

func GenerateServerTestKeyAndCert(commonName string, sanDomains []string, sanIPs []string, parent *TestCertAndKey) (*TestCertAndKey, error)

GenerateServerTestKeyAndCert generates a test server cert/key given a signing CA.

func GenerateServerTestKeyAndCertWithDate

func GenerateServerTestKeyAndCertWithDate(commonName string, sanDomains []string, sanIPs []string, parent *TestCertAndKey, notBefore time.Time) (*TestCertAndKey, error)

GenerateServerTestKeyAndCertWithDate generates a test server cert/key given a signing CA and given validity date

func (*TestCertAndKey) SaveCerts

func (t *TestCertAndKey) SaveCerts(directory, name string)

SaveCerts stores cert and key files into a given dir.

Jump to

Keyboard shortcuts

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