tls

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package tls provides utilities required for TLS such as created TLS configs allowing all the certificate format supported by Couchbase.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidPublicPrivateKeyPair is returned if the users provided public/private keys do not match.
	ErrInvalidPublicPrivateKeyPair = errors.New("private key does not match public key")

	// ErrInvalidPasswordInputDataOrKey is a broader version of the 'ParseCertKeyError' which is used as more of a
	// catchall to indicate something is wrong with the provided public/private key.
	ErrInvalidPasswordInputDataOrKey = errors.New("invalid password, input data or an unsupported public/private key " +
		"format/type")

	// ErrPasswordProvidedButUnused is returned if the user has provided a password, but we've got to a point where it
	// would no longer be used.
	ErrPasswordProvidedButUnused = errors.New("a cert/key password was provided but hasn't been used, either the " +
		"cert/key is unencrypted, or is an unsupported format")
)

Functions

func NewConfig

func NewConfig(options ConfigOptions) (*tls.Config, error)

NewConfig creates a new TLS config which can either skip SSL verification or may contain a x509 certificate pool with the users provided ca certificate.

Types

type ConfigOptions

type ConfigOptions struct {
	ClientCert           []byte
	ClientKey            []byte
	Password             []byte
	IgnoreUnusedPassword bool

	ClientAuthType tls.ClientAuthType
	ClientCAs      []byte

	RootCAs     []byte
	NoSSLVerify bool

	CipherSuites []uint16
	MinVersion   uint16
}

ConfigOptions encapsulates the available options for creating a new TLS config.

func (*ConfigOptions) Validate

func (t *ConfigOptions) Validate() error

Validate returns an error if the given TLS config is invalid for some reason.

type ParseCertKeyError

type ParseCertKeyError struct {
	// contains filtered or unexported fields
}

ParseCertKeyError is a more useful variation of 'ErrInvalidPasswordInputDataOrKey' which contains hints as to the next steps the user may be able to take to resolve the issue.

func (ParseCertKeyError) Error

func (p ParseCertKeyError) Error() string

Jump to

Keyboard shortcuts

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