Documentation
¶
Overview ¶
Package certs creates self-signed certificates and checks certificate files.
Index ¶
- Constants
- func CheckPair(certPEM, keyPEM []byte) (*x509.Certificate, error)
- func Names(serverName string) (dns []string, ips []net.IP)
- func Reusable(certPEM, keyPEM []byte, serverName string, now time.Time) bool
- func SelfSigned(serverName string, now time.Time) (certPEM, keyPEM []byte, err error)
- func SelfSignedFiles(certFile, keyFile, serverName string, now time.Time) (certPEM, keyPEM []byte, err error)
Constants ¶
const Validity = 825 * 24 * time.Hour
Validity of self-signed certificates. 825 days is the longest that macOS and iOS accept.
Variables ¶
This section is empty.
Functions ¶
func CheckPair ¶
func CheckPair(certPEM, keyPEM []byte) (*x509.Certificate, error)
CheckPair parses a certificate and its private key and checks that they match. It returns the first certificate of the chain.
func Names ¶
Names returns the DNS names and IP addresses a self-signed certificate covers for serverName.
func Reusable ¶
Reusable reports whether an existing self-signed certificate can be kept: the pair is valid, it covers serverName and it does not expire within 30 days.
func SelfSigned ¶
SelfSigned returns a new self-signed certificate and its private key, both PEM encoded.
func SelfSignedFiles ¶ added in v0.6.0
func SelfSignedFiles(certFile, keyFile, serverName string, now time.Time) (certPEM, keyPEM []byte, err error)
SelfSignedFiles returns the self-signed pair kept in certFile and keyFile. It writes a new pair when the files are missing or not Reusable for serverName. The key file gets mode 0600.
Types ¶
This section is empty.