Documentation ¶
Overview ¶
Package tlsutil contains TLS utilities.
Index ¶
- func GenerateServerCertificate(ctx context.Context, keySize int, certValid time.Duration, names []string) (*x509.Certificate, *rsa.PrivateKey, error)
- func TLSConfigTrustingSingleCertificate(sha256Fingerprint string) *tls.Config
- func TransportTrustingSingleCertificate(sha256Fingerprint string) http.RoundTripper
- func WriteCertificateToFile(fname string, cert *x509.Certificate) error
- func WritePrivateKeyToFile(fname string, priv *rsa.PrivateKey) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateServerCertificate ¶
func GenerateServerCertificate(ctx context.Context, keySize int, certValid time.Duration, names []string) (*x509.Certificate, *rsa.PrivateKey, error)
GenerateServerCertificate generates random TLS certificate and key.
func TLSConfigTrustingSingleCertificate ¶ added in v0.8.0
TLSConfigTrustingSingleCertificate return tls.Config which trusts exactly one TLS certificate with provided SHA256 fingerprint.
func TransportTrustingSingleCertificate ¶
func TransportTrustingSingleCertificate(sha256Fingerprint string) http.RoundTripper
TransportTrustingSingleCertificate return http.RoundTripper which trusts exactly one TLS certificate with provided SHA256 fingerprint.
func WriteCertificateToFile ¶
func WriteCertificateToFile(fname string, cert *x509.Certificate) error
WriteCertificateToFile writes the certificate to a given file.
func WritePrivateKeyToFile ¶
func WritePrivateKeyToFile(fname string, priv *rsa.PrivateKey) error
WritePrivateKeyToFile writes the private key to a given file.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.