certificates

package
v1.8.5 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorParamsEmpty errors.CodeError = iota + errors.MinPkgCertificate
	ErrorFileStat
	ErrorFileRead
	ErrorFileEmpty
	ErrorCertAppend
	ErrorCertKeyPairLoad
	ErrorCertKeyPairParse
	ErrorValidatorError
)

Variables

View Source
var Default = New()

Functions

func AddCACertificateContents deprecated

func AddCACertificateContents(caContent string) bool

Deprecated: use local config and no more globals default config.

func AddCACertificateFile deprecated

func AddCACertificateFile(caFile string) liberr.Error

Deprecated: use local config and no more globals default config.

func AddCertificateContents deprecated

func AddCertificateContents(keyContents, certContents string) liberr.Error

Deprecated: use local config and no more globals default config.

func AddCertificateFile deprecated

func AddCertificateFile(keyFile, certFile string) liberr.Error

Deprecated: use local config and no more globals default config.

func AddCertificatePairFile deprecated added in v1.5.0

func AddCertificatePairFile(keyFile, crtFile string) liberr.Error

Deprecated: use local config and no more globals default config.

func AddCertificatePairString deprecated added in v1.5.0

func AddCertificatePairString(key, crt string) liberr.Error

Deprecated: use local config and no more globals default config.

func AddRootCAContents deprecated

func AddRootCAContents(rootContent string) bool

Deprecated: use local config and no more globals default config.

func AddRootCAFile deprecated

func AddRootCAFile(rootFile string) liberr.Error

Deprecated: use local config and no more globals default config.

func AppendCertificates deprecated

func AppendCertificates(cert []tls.Certificate) []tls.Certificate

Deprecated: use local config and no more globals default config.

func CheckCertificates deprecated

func CheckCertificates() bool

Deprecated: use local config and no more globals default config.

func GetCertificates deprecated

func GetCertificates() []tls.Certificate

Deprecated: use local config and no more globals default config.

func GetCipherKey deprecated

func GetCipherKey(cipher string) uint16

Deprecated: use StringToCipherKey.

func GetClientCA deprecated

func GetClientCA() *x509.CertPool

Deprecated: use local config and no more globals default config.

func GetCurveID deprecated

func GetCurveID(curveRef string) tls.CurveID

Deprecated: use StringToCurveID.

func GetRootCA deprecated

func GetRootCA() *x509.CertPool

Deprecated: use local config and no more globals default config.

func GetTLSConfig deprecated

func GetTLSConfig(serverName string) *tls.Config

Deprecated: use local config and no more globals default config.

func GetTlsConfigCertificates deprecated

func GetTlsConfigCertificates() *tls.Config

Deprecated: use local config and no more globals default config.

func IsCodeError

func IsCodeError() bool

func SetCipherList deprecated

func SetCipherList(cipher []uint16)

Deprecated: use local config and no more globals default config.

func SetClientAuth deprecated

func SetClientAuth(auth string)

Deprecated: use local config and no more globals default config.

func SetCurve deprecated

func SetCurve(curves []tls.CurveID)

Deprecated: use local config and no more globals default config.

func SetDynamicSizing deprecated

func SetDynamicSizing(enable bool)

Deprecated: use local config and no more globals default config.

func SetSessionTicket deprecated

func SetSessionTicket(enable bool)

Deprecated: use local config and no more globals default config.

func SetVersionMax deprecated

func SetVersionMax(vers uint16)

Deprecated: use local config and no more globals default config.

func SetVersionMin deprecated

func SetVersionMin(vers uint16)

Deprecated: use local config and no more globals default config.

func StringToCipherKey added in v1.5.0

func StringToCipherKey(cipher string) uint16

func StringToClientAuth added in v1.5.0

func StringToClientAuth(auth string) tls.ClientAuthType

func StringToCurveID added in v1.5.0

func StringToCurveID(curveRef string) tls.CurveID

func StringToTlsVersion added in v1.5.0

func StringToTlsVersion(tlsVersStr string) uint16

func SystemRootCA added in v1.5.0

func SystemRootCA() *x509.CertPool

Types

type Certif added in v1.5.0

type Certif struct {
	Key string `mapstructure:"key" json:"key" yaml:"key" toml:"key"`
	Pem string `mapstructure:"pem" json:"pem" yaml:"pem" toml:"pem"`
}

type Config added in v1.5.0

type Config struct {
	CurveList            []string `mapstructure:"curveList" json:"curveList" yaml:"curveList" toml:"curveList"`
	CipherList           []string `mapstructure:"cipherList" json:"cipherList" yaml:"cipherList" toml:"cipherList"`
	RootCAString         []string `mapstructure:"rootCA" json:"rootCA" yaml:"rootCA" toml:"rootCA"`
	RootCAFile           []string `mapstructure:"rootCAFiles" json:"rootCAFiles" yaml:"rootCAFiles" toml:"rootCAFiles"`
	ClientCAString       []string `mapstructure:"clientCA" json:"clientCA" yaml:"clientCA" toml:"clientCA"`
	ClientCAFiles        []string `mapstructure:"clientCAFiles" json:"clientCAFiles" yaml:"clientCAFiles" toml:"clientCAFiles"`
	CertPairString       []Certif `mapstructure:"certPair" json:"certPair" yaml:"certPair" toml:"certPair"`
	CertPairFile         []Certif `mapstructure:"certPairFiles" json:"certPairFiles" yaml:"certPairFiles" toml:"certPairFiles"`
	VersionMin           string   `mapstructure:"versionMin" json:"versionMin" yaml:"versionMin" toml:"versionMin"`
	VersionMax           string   `mapstructure:"versionMax" json:"versionMax" yaml:"versionMax" toml:"versionMax"`
	AuthClient           string   `mapstructure:"authClient" json:"authClient" yaml:"authClient" toml:"authClient"`
	InheritDefault       bool     `mapstructure:"inheritDefault" json:"inheritDefault" yaml:"inheritDefault" toml:"inheritDefault"`
	DynamicSizingDisable bool     `mapstructure:"dynamicSizingDisable" json:"dynamicSizingDisable" yaml:"dynamicSizingDisable" toml:"dynamicSizingDisable"`
	SessionTicketDisable bool     `mapstructure:"sessionTicketDisable" json:"sessionTicketDisable" yaml:"sessionTicketDisable" toml:"sessionTicketDisable"`
}

func (*Config) New added in v1.5.0

func (c *Config) New() (TLSConfig, liberr.Error)

func (*Config) NewFrom added in v1.5.0

func (c *Config) NewFrom(cfg TLSConfig) (TLSConfig, liberr.Error)

nolint #gocognit

func (*Config) Validate added in v1.5.0

func (c *Config) Validate() liberr.Error

type TLSConfig added in v1.5.0

type TLSConfig interface {
	AddRootCAString(rootCA string) bool
	AddRootCAFile(pemFile string) liberr.Error
	GetRootCA() *x509.CertPool

	AddClientCAString(ca string) bool
	AddClientCAFile(pemFile string) liberr.Error
	GetClientCA() *x509.CertPool

	AddCertificatePairString(key, crt string) liberr.Error
	AddCertificatePairFile(keyFile, crtFile string) liberr.Error
	LenCertificatePair() int
	GetCertificatePair() []tls.Certificate

	SetVersionMin(vers uint16)
	SetVersionMax(vers uint16)
	SetClientAuth(cAuth tls.ClientAuthType)
	SetCipherList(cipher []uint16)
	SetCurveList(curves []tls.CurveID)
	SetDynamicSizingDisabled(flag bool)
	SetSessionTicketDisabled(flag bool)

	Clone() TLSConfig
	TlsConfig(serverName string) *tls.Config
}

func New added in v1.5.0

func New() TLSConfig

Jump to

Keyboard shortcuts

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