certs

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2020 License: Apache-2.0 Imports: 18 Imported by: 2

Documentation

Index

Constants

View Source
const (
	CertificatePath                 string = "/milpa/certificate"
	CertificateDirectoryPlaceholder string = "/milpa/certificate/."
	RootCertPath                    string = "/milpa/certificate/root.crt"
	RootKeyPath                     string = "/milpa/certificate/root.key"
)

Variables

This section is empty.

Functions

func CreateCert

func CreateCert(rootCert *x509.Certificate, rootPrivateKey *ecdsa.PrivateKey, serverPublicKey *ecdsa.PublicKey, certUsage CertUsageType) (*x509.Certificate, error)

func CreateRootCert

func CreateRootCert(privateKey *ecdsa.PrivateKey) (*x509.Certificate, error)

func LoadCert

func LoadCert(filename string) (*x509.Certificate, error)

func LoadKey

func LoadKey(filename string) (*ecdsa.PrivateKey, error)

func MarshalCert

func MarshalCert(cert *x509.Certificate) (text []byte, err error)

func MarshalKey

func MarshalKey(privateKey *ecdsa.PrivateKey) (text []byte, err error)

func NewClientTLSConfig

func NewClientTLSConfig(cacert, cert, key, serverName string) (*tls.Config, error)

func NewServerTLSConfig

func NewServerTLSConfig(cacert, cert, key string) (*tls.Config, error)

func NewTLSConfig

func NewTLSConfig(cacert, cert, key, serverName string, isServer bool) (*tls.Config, error)

func SaveCert

func SaveCert(filename string, cert *x509.Certificate) error

func SaveKey

func SaveKey(filename string, privateKey *ecdsa.PrivateKey) error

func UnmarshalCert

func UnmarshalCert(b []byte) (*x509.Certificate, error)

func UnmarshalKey

func UnmarshalKey(b []byte) (*ecdsa.PrivateKey, error)

Types

type CertUsageType

type CertUsageType int
const (
	ClientCert CertUsageType = iota
	ServerCert
)

type CertificateFactory

type CertificateFactory struct {
	Root x509.Certificate
	// contains filtered or unexported fields
}

func New

func New(kvstore etcd.Storer) (*CertificateFactory, error)

func NewFake

func NewFake() (*CertificateFactory, error)

func (*CertificateFactory) CreateClientCert

func (fac *CertificateFactory) CreateClientCert() (*tls.Certificate, error)

func (*CertificateFactory) CreateNodeCertAndKey

func (fac *CertificateFactory) CreateNodeCertAndKey() (*x509.Certificate, *ecdsa.PrivateKey, error)

func (*CertificateFactory) GetRootFromStore

func (fac *CertificateFactory) GetRootFromStore() error

func (*CertificateFactory) InitRootCert

func (fac *CertificateFactory) InitRootCert() error

Jump to

Keyboard shortcuts

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