Documentation ¶
Overview ¶
Package cert defines helper functions to generate TLS certificates.
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func New ¶
func New(recipe Recipe, isCA bool) (*tls.Certificate, error)
New simply wraps NewFile with parameters set not to generate any files.
func NewFile ¶
NewFile generates self-signed x509 certificate and returns it. Both :certFile and :keyFile should be filled or empty else will return error. To use as x509.Certificate, access .Leaf field of returned certificate.
Reference: https://golang.org/src/crypto/tls/generate_cert.go
Types ¶
type Recipe ¶
type Recipe struct { // CA certificate to sign with. generated certificate is self-signed if CA is nil. CA *tls.Certificate // Names and IPs of hosts to generate certificate for. // Returns error if empty. Hosts []string // Key algorithm and strength to use in format 'algorhtm[:strength]'. // Available keyspecs are: rsa:<int>, ecdsa:p224/p256/p384/p521, ed25519. KeySpec string // Validity of the certificate. ValidFrom time.Time ValidFor time.Duration }
Recipe specify detail of certificate generation
Click to show internal directories.
Click to hide internal directories.