ssl

package
v3.2.5+incompatible Latest Latest
Warning

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

Go to latest
Published: May 27, 2021 License: Apache-2.0 Imports: 12 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendKeyPair

func AppendKeyPair(tlsConfig *tls.Config, certFile string, keyFile string) error

AppendKeyPair loads the given TLS key pair and appends it to tlsConfig.Certificates.

func AppendKeyPairWithPassword

func AppendKeyPairWithPassword(tlsConfig *tls.Config, certFile string, keyFile string, pemPass []byte) error

Read in a keypair where the key is password protected

func GetPEMPassword

func GetPEMPassword(pemFile string) []byte

Print a password prompt on the terminal and collect a password

func HasString

func HasString(elem string, arr []string) bool

Determine if a string element is in a string array

func IsEncryptedPEM

func IsEncryptedPEM(pemFile string) bool

Determine if PEM file is encrypted

func ListenAndServeTLS

func ListenAndServeTLS(addr string, handler nethttp.Handler, tlsConfig *tls.Config) error

ListenAndServeTLS acts identically to http.ListenAndServeTLS, except that it expects TLS configuration. TODO: refactor so this is testable?

func NewTLSConfig

func NewTLSConfig(caFile string, verifyCert bool) (*tls.Config, error)

NewTLSConfig returns an initialized TLS configuration suitable for client authentication. If caFile is non-empty, it will be loaded.

func ReadCAFile

func ReadCAFile(caFile string) (*x509.CertPool, error)

Returns CA certificate. If caFile is non-empty, it will be loaded.

func ReadPEMData

func ReadPEMData(pemFile string, pemPass []byte) ([]byte, error)

Read a PEM file and ask for a password to decrypt it if needed

func Verify

func Verify(r *nethttp.Request, validOUs []string) error

Verify that the OU of the presented client certificate matches the list of Valid OUs

func VerifyOUs

func VerifyOUs(validOUs []string) martini.Handler

TODO: make this testable?

Types

This section is empty.

Jump to

Keyboard shortcuts

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