pki

package
v0.4.14 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClientSigningProfile = "client"
	PeerSigningProfile   = "peer"
	ServerSigningProfile = "server"
)

Variables

View Source
var (
	SigningProfiles = &config.Signing{
		Default: &config.SigningProfile{
			Expiry: 5 * 365 * 24 * time.Hour,
		},
		Profiles: map[string]*config.SigningProfile{
			ClientSigningProfile: {
				Expiry: 5 * 365 * 24 * time.Hour,
				Usage: []string{
					"signing",
					"key encipherment",
					"client auth",
				},
			},
			PeerSigningProfile: {
				Expiry: 5 * 365 * 24 * time.Hour,
				Usage: []string{
					"signing",
					"key encipherment",
					"server auth",
					"client auth",
				},
			},
			ServerSigningProfile: {
				Expiry: 5 * 365 * 24 * time.Hour,
				Usage: []string{
					"signing",
					"key encipherment",
					"server auth",
				},
			},
		},
	}
)

Functions

func GenerateCertHash

func GenerateCertHash(caCertPath string) ([]byte, error)

Types

type KeyPair

type KeyPair struct {
	Cert    *x509.Certificate
	CertPEM []byte
	Key     crypto.Signer
	KeyPEM  []byte
}

func NewKeyPairFromPEM

func NewKeyPairFromPEM(certPEM, keyPEM []byte) (*KeyPair, error)

type RootCA

type RootCA struct {
	CA *KeyPair
	// contains filtered or unexported fields
}

func NewDefaultRootCA

func NewDefaultRootCA() (*RootCA, error)

func NewRootCA

func NewRootCA(cr *csr.CertificateRequest) (*RootCA, error)

func NewRootCAFromFile

func NewRootCAFromFile(certpath, keypath string) (*RootCA, error)

func (*RootCA) GenerateCertificates

func (r *RootCA) GenerateCertificates(profile string, cr *csr.CertificateRequest) (*KeyPair, error)

Jump to

Keyboard shortcuts

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