Documentation ¶
Index ¶
- Variables
- func Certificate(certPEMBase64, keyPEMBase64 string, certPath, keyPath string) ([]tls.Certificate, error)
- func CertificateFromBase64(certBase64, keyBase64 string) (tls.Certificate, error)
- func CertificateHelpMessage(prefix string) string
- func CreateSelfSignedCertificate(key interface{}) (cert *x509.Certificate, err error)
- func CreateSelfSignedTLSCertificate(key interface{}) (*tls.Certificate, error)
- func GetCertificate(ctx context.Context, certPath, keyPath string, errs chan<- error) (func(*tls.ClientHelloInfo) (*tls.Certificate, error), error)
- func HTTPSCertificate() ([]tls.Certificate, error)
- func HTTPSCertificateHelpMessage() string
- func PEMBlockForKey(key interface{}) (*pem.Block, error)
- func PublicKey(key crypto.PrivateKey) interface{ ... }
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidCertificateConfiguration = errors.New("tls configuration is invalid")
ErrInvalidCertificateConfiguration is returned when an invalid TLS configuration was found.
var ErrNoCertificatesConfigured = errors.New("no tls configuration was found")
ErrNoCertificatesConfigured is returned when no TLS configuration was found.
Functions ¶
func Certificate ¶
func Certificate( certPEMBase64, keyPEMBase64 string, certPath, keyPath string, ) ([]tls.Certificate, error)
[deprecated] Certificate returns a TLS Certificate by looking at its arguments. If both certPEMBase64 and keyPEMBase64 are not empty and contain base64-encoded PEM representations of a cert and key, respectively, that key pair is returned. Otherwise, if certPath and keyPath point to PEM files, the key pair is loaded from those. Returns ErrNoCertificatesConfigured if all arguments are empty, and ErrInvalidCertificateConfiguration if the arguments are inconsistent.
This function is deprecated. Use CertificateFromBase64 or GetCertificate instead.
func CertificateFromBase64 ¶ added in v0.0.474
func CertificateFromBase64(certBase64, keyBase64 string) (tls.Certificate, error)
CertificateFromBase64 loads a TLS certificate from a base64-encoded string of the PEM representations of the cert and key.
func CertificateHelpMessage ¶
CertificateHelpMessage returns a help message for configuring TLS Certificates.
func CreateSelfSignedCertificate ¶ added in v0.0.12
func CreateSelfSignedCertificate(key interface{}) (cert *x509.Certificate, err error)
CreateSelfSignedCertificate creates a self-signed x509 certificate.
func CreateSelfSignedTLSCertificate ¶ added in v0.0.28
func CreateSelfSignedTLSCertificate(key interface{}) (*tls.Certificate, error)
CreateSelfSignedTLSCertificate creates a self-signed TLS certificate.
func GetCertificate ¶ added in v0.0.474
func GetCertificate( ctx context.Context, certPath, keyPath string, errs chan<- error, ) (func(*tls.ClientHelloInfo) (*tls.Certificate, error), error)
GetCertificate returns a function for use with "net/tls".Config.GetCertificate.
The certificate and private key are read from the specified filesystem paths. The certificate file is watched for changes, upon which the cert+key are reloaded in the background. Errors during reloading are deduplicated and reported through the errs channel if it is not nil. When the provided context is canceled, background reloading stops and the errs channel is closed.
The returned function always yields the latest successfully loaded certificate; ClientHelloInfo is unused.
func HTTPSCertificate ¶
func HTTPSCertificate() ([]tls.Certificate, error)
HTTPSCertificate returns loads a HTTP over TLS Certificate by looking at environment variables.
func HTTPSCertificateHelpMessage ¶
func HTTPSCertificateHelpMessage() string
HTTPSCertificateHelpMessage returns a help message for configuring HTTP over TLS Certificates.
func PEMBlockForKey ¶ added in v0.0.28
PEMBlockForKey returns a PEM-encoded block for key.
Types ¶
This section is empty.