tlsutil

package
v0.10.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package tlsutil contains TLS utilities.

Index

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

func TLSConfigTrustingSingleCertificate(sha256Fingerprint string) *tls.Config

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL