pki

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

README

Basic PKI based on cfssl

Documentation

Index

Constants

View Source
const (
	DefaultAlgo = "rsa"
	DefaultSize = 2048
)

Variables

This section is empty.

Functions

func NewRequest

func NewRequest(cn string, opts ...Option) *csr.CertificateRequest

func Save

func Save(certPath string, cert []byte, keyPath string, key []byte) error

func SetLogger

func SetLogger(fieldLogger logrus.FieldLogger)

Types

type Option

type Option func(r *csr.CertificateRequest)

func WithHosts

func WithHosts(hosts ...string) Option

func WithKeyRequest

func WithKeyRequest(kr *csr.KeyRequest) Option

func WithNames

func WithNames(names ...csr.Name) Option

type PKI added in v0.0.2

type PKI interface {
	Generate(req *csr.CertificateRequest, profile Profile) (cert, key []byte, err error)
	CACert() []byte
	CAKey() []byte
	NewIntermediate(csr *csr.CertificateRequest) (PKI, error)
	Save(certPath string, keyPath string) error
}

func NewPKIFromBytes

func NewPKIFromBytes(cert, key []byte) (PKI, error)

func NewPKIFromCSR

func NewPKIFromCSR(csr *csr.CertificateRequest) (PKI, error)

func NewPKIFromFiles

func NewPKIFromFiles(caCert, caKey string) (PKI, error)

type Profile

type Profile string
const (
	ProfileIntermediateCA Profile = "intermediate_ca"
	ProfilePeer           Profile = "peer"
	ProfileServer         Profile = "server"
	ProfileClient         Profile = "client"
)

func (Profile) Validate

func (p Profile) Validate() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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