tlsutil – github.com/hashicorp/go-secure-stdlib/tlsutil Index | Files

package tlsutil

import "github.com/hashicorp/go-secure-stdlib/tlsutil"

Index

Variables

var ErrInvalidCertParams = errors.New("invalid certificate parameters")
var TLSLookup = map[string]uint16{
	"tls10": tls.VersionTLS10,
	"tls11": tls.VersionTLS11,
	"tls12": tls.VersionTLS12,
	"tls13": tls.VersionTLS13,
}

TLSLookup maps the tls_min_version configuration to the internal value

Functions

func ClientTLSConfig

func ClientTLSConfig(caCert []byte, clientCert []byte, clientKey []byte) (*tls.Config, error)

ClientTLSConfig parses the CA certificate, and optionally a public/private client certificate key pair. The certificates must be in PEM encoded format.

func GetCipherName

func GetCipherName(cipher uint16) (string, error)

GetCipherName returns the name of a given cipher suite code or an error if the given cipher is unsupported.

func LoadClientTLSConfig

func LoadClientTLSConfig(caCert, clientCert, clientKey string) (*tls.Config, error)

LoadClientTLSConfig loads and parse the CA certificate, and optionally a public/private client certificate key pair. The certificates must be in PEM encoded format.

func ParseCiphers

func ParseCiphers(cipherStr string) ([]uint16, error)

ParseCiphers parse ciphersuites from the comma-separated string into recognized slice

func SetupTLSConfig

func SetupTLSConfig(conf map[string]string, address string) (*tls.Config, error)

Source Files

tlsutil.go

Version
v0.1.3 (latest)
Published
Oct 27, 2023
Platform
linux/amd64
Imports
9 packages
Last checked
1 month ago

Tools for package owners.