certificates

package
v1.17.3 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorParamEmpty liberr.CodeError = iota + liberr.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) error

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

func AddCertificateContents deprecated

func AddCertificateContents(keyContents, certContents string) error

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

func AddCertificateFile deprecated

func AddCertificateFile(keyFile, certFile string) error

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

func AddCertificatePairFile deprecated added in v1.5.0

func AddCertificatePairFile(keyFile, crtFile string) error

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

func AddCertificatePairString deprecated added in v1.5.0

func AddCertificatePairString(key, crt string) 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) 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 GetClientCA deprecated

func GetClientCA() *x509.CertPool

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

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 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 SystemRootCA added in v1.5.0

func SystemRootCA() *x509.CertPool

Types

type CertifOld added in v1.17.0

type CertifOld 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            []tlscrv.Curves   `mapstructure:"curveList" json:"curveList" yaml:"curveList" toml:"curveList"`
	CipherList           []tlscpr.Cipher   `mapstructure:"cipherList" json:"cipherList" yaml:"cipherList" toml:"cipherList"`
	RootCA               []tlscas.Cert     `mapstructure:"rootCA" json:"rootCA" yaml:"rootCA" toml:"rootCA"`
	ClientCA             []tlscas.Cert     `mapstructure:"clientCA" json:"clientCA" yaml:"clientCA" toml:"clientCA"`
	Certs                []tlscrt.Certif   `mapstructure:"certs" json:"certs" yaml:"certs" toml:"certs"`
	VersionMin           tlsvrs.Version    `mapstructure:"versionMin" json:"versionMin" yaml:"versionMin" toml:"versionMin"`
	VersionMax           tlsvrs.Version    `mapstructure:"versionMax" json:"versionMax" yaml:"versionMax" toml:"versionMax"`
	AuthClient           tlsaut.ClientAuth `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

func (*Config) NewFrom added in v1.5.0

func (c *Config) NewFrom(cfg TLSConfig) TLSConfig

nolint #gocognit

func (*Config) Validate added in v1.5.0

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

type ConfigOld added in v1.17.0

type ConfigOld 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       []CertifOld `mapstructure:"certPair" json:"certPair" yaml:"certPair" toml:"certPair"`
	CertPairFile         []CertifOld `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 (*ConfigOld) ToConfig added in v1.17.0

func (c *ConfigOld) ToConfig() Config

type FctHttpClient added in v1.10.0

type FctHttpClient func(def TLSConfig, servername string) *http.Client

type FctRootCA added in v1.13.10

type FctRootCA func() []string

type FctRootCACert added in v1.17.0

type FctRootCACert func() tlscas.Cert

type FctTLSDefault added in v1.10.0

type FctTLSDefault func() TLSConfig

type TLSConfig added in v1.5.0

type TLSConfig interface {
	RegisterRand(rand io.Reader)

	AddRootCA(rootCA tlscas.Cert) bool
	AddRootCAString(rootCA string) bool
	AddRootCAFile(pemFile string) error
	GetRootCA() []tlscas.Cert
	GetRootCAPool() *x509.CertPool

	AddClientCAString(ca string) bool
	AddClientCAFile(pemFile string) error
	GetClientCA() []tlscas.Cert
	GetClientCAPool() *x509.CertPool
	SetClientAuth(a tlsaut.ClientAuth)

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

	SetVersionMin(v tlsvrs.Version)
	GetVersionMin() tlsvrs.Version
	SetVersionMax(v tlsvrs.Version)
	GetVersionMax() tlsvrs.Version

	SetCipherList(c []tlscpr.Cipher)
	AddCiphers(c ...tlscpr.Cipher)
	GetCiphers() []tlscpr.Cipher

	SetCurveList(c []tlscrv.Curves)
	AddCurves(c ...tlscrv.Curves)
	GetCurves() []tlscrv.Curves

	SetDynamicSizingDisabled(flag bool)
	SetSessionTicketDisabled(flag bool)

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

func New added in v1.5.0

func New() TLSConfig

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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