common

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TLSCipherSuiteMap = map[string]uint16{
	"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256": tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
	"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384": tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
}

TLSCipherSuiteMap is a map with key of type string and value of type unsigned integer

View Source
var TLSVersionMap = map[string]uint16{
	"TLSv1.0": tls.VersionTLS10,
	"TLSv1.1": tls.VersionTLS11,
	"TLSv1.2": tls.VersionTLS12,
}

TLSVersionMap is a map with key of type string and value of type unsigned integer

Functions

func GetClientTLSConfig

func GetClientTLSConfig(sslConfig *SSLConfig) (*tls.Config, error)

GetClientTLSConfig function gets client side TLS config

func GetServerTLSConfig

func GetServerTLSConfig(sslConfig *SSLConfig) (*tls.Config, error)

GetServerTLSConfig function gets server side TLD config

func GetX509CACertPool

func GetX509CACertPool(caCertFile string) (*x509.CertPool, error)

GetX509CACertPool read a certificate file and gets the certificate configuration

func LoadTLSCertificate

func LoadTLSCertificate(certFile, keyFile, passphase string, cipher security.Cipher) ([]tls.Certificate, error)

LoadTLSCertificate function loads the TLS certificate

func ParseSSLCipherSuites

func ParseSSLCipherSuites(ciphers string) ([]uint16, error)

ParseSSLCipherSuites function parses cipher suites in to a list

func ParseSSLProtocol

func ParseSSLProtocol(sprotocol string) (uint16, error)

ParseSSLProtocol function parses SSL protocols

Types

type SSLConfig

type SSLConfig struct {
	CipherPlugin string   `yaml:"cipher_plugin" json:"cipherPlugin"`
	VerifyPeer   bool     `yaml:"verify_peer" json:"verifyPeer"`
	CipherSuites []uint16 `yaml:"cipher_suites" json:"cipherSuits"`
	MinVersion   uint16   `yaml:"min_version" json:"minVersion"`
	MaxVersion   uint16   `yaml:"max_version" json:"maxVersion"`
	CAFile       string   `yaml:"ca_file" json:"caFile"`
	CertFile     string   `yaml:"cert_file" json:"certFile"`
	KeyFile      string   `yaml:"key_file" json:"keyFile"`
	CertPWDFile  string   `yaml:"cert_pwd_file" json:"certPwdFile"`
}

SSLConfig struct stores the necessary info for SSL configuration

Jump to

Keyboard shortcuts

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