manager

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FilePrivateKey  = "PRIVATE KEY"
	FileCertificate = "CERTIFICATE"
)

File literals constants

Variables

View Source
var (
	ErrUnparseableFile = errors.New("unparseable file")
	ErrCommonNameBlank = errors.New("common name cannot be blank")
	ErrKeyInvalid      = errors.New("key has invalid type")
)

Errors

Functions

func APITox509Certificate

func APITox509Certificate(request client.APICertificateRequest) *x509.Certificate

APITox509Certificate creates a x509.Certificate from the API request

func CertificateFromPEM

func CertificateFromPEM(certPEM []byte) (cert *x509.Certificate, err error)

CertificateFromPEM returns a x509.Certificate from the cert PEM and Key bytes

func New

func New(request client.APICertificateRequest) ([]byte, []byte, error)

New creates a new CA certificate/key pair ready to use

func PrivateKeyFromPEM

func PrivateKeyFromPEM(keyPEM []byte) (key crypto.PrivateKey, err error)

PrivateKeyFromPEM returns a crypto.PrivateKey (rsa or ecdsa) from the PEM bytes

Types

type CA

type CA struct {
	// contains filtered or unexported fields
}

CA is the root struct that manages the certificate workflows

func FromBytes

func FromBytes(caCertificate, caKey []byte) (*CA, error)

FromBytes creates a new CA struct from the certificate DER bytes

func (*CA) CACertificate

func (c *CA) CACertificate() *x509.Certificate

CACertificate returns the x509 CA certificate

func (*CA) CACertificateBytes

func (c *CA) CACertificateBytes() []byte

CACertificateBytes returns the CA certificate []byte

func (*CA) CreateCertificate

func (c *CA) CreateCertificate(request *x509.Certificate, key crypto.PrivateKey) ([]byte, []byte, error)

CreateCertificate creates a new certificate from the information passed as request returns the PEM files for the certificate and its key

func (*CA) CreateCertificateFromAPI

func (c *CA) CreateCertificateFromAPI(request client.APICertificateRequest) ([]byte, []byte, error)

CreateCertificateFromAPI creates a new certificate from the information passed as request returns the PEM files for the certificate and its key

Jump to

Keyboard shortcuts

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