Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CertConfig ¶
type CertConfig struct {
// Bits represents the cipher strength for the generated certificate.
// Examples: 2048 or 4096.
Bits int
// Subject represents all of the issuer contact details, e.g. locality,
// state/province, and common name.
Subject pkix.Name
// Expires represents the time and date that the certificate is valid until.
Expires time.Time
// Hostnames is a set of alternative names that the certificate will
// work for.
Hostnames []string
// IPAddresses is a set of alternate IP addresses the certificate will
// work for.
IPAddresses []net.IP
}
CertConfig provides the necessary input information required to generate a valid TLS certificate.
func NewCertConfig ¶
func NewCertConfig() CertConfig
NewCertConfig creates a new CertConfig with all of the required details filled in to workable defaults. It will add _all_ found local IP addresses as alternative IP addresses. It will also add the os.Hostname and "localhost" as valid alternate names. The expires date will be set to 20 years from the current time.
type CertificatePair ¶
type CertificatePair struct {
Certificate tls.Certificate
PrivateKeyPEM []byte
PublicKeyPEM []byte
CertificatePEM []byte
}
CertificatePair represents the final TLS certificate data as constituent parts.
func NewCertificate ¶
func NewCertificate(config CertConfig) (*CertificatePair, error)
NewCertificate generates a new self-signed TLS certificate.
func (CertificatePair) String ¶
func (cp CertificatePair) String() string
String renders the TLS cert as a set of PEM blocks suitable for writing to stdout or to a file.