Documentation ¶
Index ¶
- Constants
- Variables
- func APITox509Certificate(request client.APICertificateRequest) *x509.Certificate
- func CertificateFromPEM(certPEM []byte) (cert *x509.Certificate, err error)
- func New(request client.APICertificateRequest) ([]byte, []byte, error)
- func PrivateKeyFromPEM(keyPEM []byte) (key crypto.PrivateKey, err error)
- type CA
Constants ¶
const ( FilePrivateKey = "PRIVATE KEY" FileCertificate = "CERTIFICATE" )
File literals constants
Variables ¶
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 (*CA) CACertificate ¶
func (c *CA) CACertificate() *x509.Certificate
CACertificate returns the x509 CA certificate
func (*CA) CACertificateBytes ¶
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 ¶
CreateCertificateFromAPI creates a new certificate from the information passed as request returns the PEM files for the certificate and its key