entity

package
v0.0.0-...-11186bd Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package entity provides a lightweight method for generating certificates.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Template

func Template(cn string) *x509.Certificate

Template returns a leaf x509 template with cn as common name.

func TemplateCA

func TemplateCA(cn string) *x509.Certificate

TemplateCA returns a CA x509 template with cn as common name.

Types

type Entity

type Entity struct {
	Template    *x509.Certificate
	PrivateKey  crypto.PrivateKey
	PublicKey   crypto.PublicKey
	Certificate *tls.Certificate
}

Entity contains a certificate, associated template, public and private keys.

func CreateSelfSigned

func CreateSelfSigned(cn string, priv crypto.PrivateKey) (*Entity, error)

CreateSelfSigned creates an Entity with a self signed certificate.

func CreateSigned

func CreateSigned(cn string, priv crypto.PrivateKey, parent *Entity) (*Entity, error)

CreateSigned creates an Entity with a certificate signed by parent.

func CreateSignedCA

func CreateSignedCA(cn string, priv crypto.PrivateKey, parent *Entity) (*Entity, error)

CreateSignedCA creates an Entity with a CA certificate signed by parent.

func FromFile

func FromFile(certFile, privKeyFile string) (*Entity, error)

FromFile loads an Entity with a certificate and private key from file.

func FromSigningRequest

func FromSigningRequest(csr *x509.CertificateRequest) (*Entity, error)

FromSigningRequest creates the boilerplate for a new certificate out of a Signing Request.

func NewEntity

func NewEntity(template *x509.Certificate, privateKey crypto.PrivateKey) (*Entity, error)

NewEntity creates the boilerplate for a new certificate out of a template.

func (*Entity) SignWith

func (e *Entity) SignWith(parent *Entity) error

SignWith signs the boilerplate certificate with the parent certificate.

func (*Entity) SignedBy

func (e *Entity) SignedBy(parent *Entity) error

SignedBy returns error if the certificate is not signed by parent.

func (*Entity) SigningRequest

func (e *Entity) SigningRequest() ([]byte, error)

SigningRequest generates a Certificate Signing Request out of the Entity.

Jump to

Keyboard shortcuts

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