Documentation ¶
Overview ¶
Package internal holds the internal details of creating a self-signed certificate from either a Root CA or individual cert.
Index ¶
- func CreateCertificateAndPrivateKey(params *Params) ([]byte, []byte, error)
- func CreateCertificateAndPrivateKeyFiles(publicCertificateFilePath string, privateKeyFilePath string, params *Params) error
- func ReadKeyPair(publicCertFileData []byte, privateKeyFileData []byte) (*x509.Certificate, *rsa.PrivateKey, error)
- type Params
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateCertificateAndPrivateKey ¶
CreateCertificateAndPrivateKey returns the public certificate and private key pair as byte arrays.
func CreateCertificateAndPrivateKeyFiles ¶
func CreateCertificateAndPrivateKeyFiles(publicCertificateFilePath string, privateKeyFilePath string, params *Params) error
CreateCertificateAndPrivateKeyFiles writes the random public certificate and private key pair to disk.
func ReadKeyPair ¶
func ReadKeyPair(publicCertFileData []byte, privateKeyFileData []byte) (*x509.Certificate, *rsa.PrivateKey, error)
ReadKeyPair takes PEM-encoded public certificate/private key pairs and returns the Go classes for them so they can be used for encryption or signing.
Types ¶
type Params ¶
type Params struct { // If true, indicates that this certificate is a root certificate. // Root certificates are used to establish a chain of trust. // This means that if the root certificate is trusted certificates derived from it are also trusted. CertificateAuthority bool // (optional) Root certificate that will be used to create the new derived certificate from. RootPublicCertificateData []byte // (optional) Root private that will be used to create the new derived certificate from. RootPrivateKeyData []byte // The duration from now when the certificate will expire. ValidityDuration time.Duration // List of hostnames that this certificate is valid for. Clients verify that this Hostnames []string // RSA encryption key length. RSAKeyLength int }
Params for creating an X.509 certificate and RSA private key pair for TLS.
Click to show internal directories.
Click to hide internal directories.