Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SelfSignedCert ¶
func SelfSignedCert(opts ...Opt) (tls.Certificate, error)
SelfSignedCert will generate a self-signed certificate with all the passed options (see all Opt implementations).
Return value is a *tls.Certificate, which will contain the X509 certificate struct:
tlsCert := &tls.Certificate { Certificate: [][]byte{x509Cert.Raw}, PrivateKey: privateKey, Leaf: x509Cert, // The x509 certificate struct. }
The resultant *tls.Certificate can be used directly in a *tls.Config of the server.
Types ¶
type Opt ¶
type Opt func(cert *x509.Certificate)
Opt represents a parameter for creating a new self-signed certificate. See implementations below.
func WithCertCommonName ¶
func WithCertDNSNames ¶
func WithCertIpAddresses ¶
func WithCertNotAfter ¶
func WithCertNotBefore ¶
func WithCertOrganization ¶
func WithCertSerialNumber ¶
Click to show internal directories.
Click to hide internal directories.