Documentation ¶
Index ¶
- func GenSelfSignedCA(name string, expiry time.Time) (cert *x509.Certificate, key *rsa.PrivateKey, err error)
- func GenSignedCert(caCert *x509.Certificate, caKey *rsa.PrivateKey, commonName string, ...) (cert *x509.Certificate, key *rsa.PrivateKey, firstErr error)
- func GetCert(ctx context.Context, url string, certPassword string) (cert *x509.Certificate, caCerts []*x509.Certificate, key *rsa.PrivateKey, ...)
- func GetMTLSClientConfig(ctx context.Context, caURL string, caPassword string, clientName string, ...) (*tls.Config, error)
- func GetMTLSServerConfig(ctx context.Context, caURL string, caPassword string, hostname string, ...) (*tls.Config, error)
- func TLSCertificate(certs []*x509.Certificate, key *rsa.PrivateKey) (tls.Certificate, error)
- func UploadCert(ctx context.Context, url string, cert *x509.Certificate, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenSelfSignedCA ¶ added in v0.0.13
func GenSelfSignedCA( name string, expiry time.Time, ) (cert *x509.Certificate, key *rsa.PrivateKey, err error)
GenSelfSignedCA generates a self-signed Certificate Authority certificate and key.
func GenSignedCert ¶
func GenSignedCert( caCert *x509.Certificate, caKey *rsa.PrivateKey, commonName string, sans []string, expiry time.Time, ) (cert *x509.Certificate, key *rsa.PrivateKey, firstErr error)
GenSignedCert generates a new certificate that has been signed by the provided certificate authority (CA). The provided hostname will be used as the CommonName (CN), and the list of sans, Subject Alternative Names (SAN), are added to the certificate as well.
For mTLS, it is important that the server's hostname matches that of the certificate. For alternative addresses, simply add them to the sans list.
func GetCert ¶
func GetCert( ctx context.Context, url string, certPassword string, ) (cert *x509.Certificate, caCerts []*x509.Certificate, key *rsa.PrivateKey, err error)
func GetMTLSClientConfig ¶ added in v0.0.3
func GetMTLSServerConfig ¶ added in v0.0.3
func TLSCertificate ¶ added in v0.0.3
func TLSCertificate(certs []*x509.Certificate, key *rsa.PrivateKey) (tls.Certificate, error)
TLSCertificate returns a tls.Certificate from the provided certs and key
func UploadCert ¶
func UploadCert( ctx context.Context, url string, cert *x509.Certificate, caCerts []*x509.Certificate, key *rsa.PrivateKey, certPassword string, ) error
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.