cert

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2022 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NodeCSRTempl string = `` /* 294-byte string literal not displayed */

Functions

func CreateRootCA

func CreateRootCA(configName, labCARoot string, ns map[string]nodes.Node) error

CreateRootCA creates RootCA key/certificate if it is needed by the topology

Types

type CaRootInput

type CaRootInput struct {
	CommonName       string
	Country          string
	Locality         string
	Organization     string
	OrganizationUnit string
	Expiry           string

	Prefix string
	Names  map[string]string // Not used right now
	// prefix for certificate/key file name
	NamePrefix string
}

CaRootInput struct

type CertInput

type CertInput struct {
	Hosts            []string
	CommonName       string
	Country          string
	Locality         string
	Organization     string
	OrganizationUnit string
	Expiry           string

	Name     string
	LongName string
	Fqdn     string
	Prefix   string
}

CertInput struct

type Certificates

type Certificates struct {
	Key  []byte
	Csr  []byte
	Cert []byte
}

func GenerateCert

func GenerateCert(ca, caKey string, csrJSONTpl *template.Template, input CertInput, targetPath string) (*Certificates, error)

GenerateCert generates and signs a certificate passed as input and saves the certificate and generated private key by path CA used to sign the cert is passed as ca and caKey file paths

func GenerateRootCa

func GenerateRootCa(labCARoot string, csrRootJsonTpl *template.Template, input CaRootInput) (*Certificates, error)

GenerateRootCa function

func RetrieveNodeCertData

func RetrieveNodeCertData(n *types.NodeConfig, labCADir string) (*Certificates, error)

RetrieveNodeCertData reads the node private key and certificate by the well known paths if either of those files doesn't exist, an error is returned

Jump to

Keyboard shortcuts

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