tls_

package
v1.0.21 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidCertificateConfiguration = errors.New("tls configuration is invalid")

ErrInvalidCertificateConfiguration is returned when an invaloid TLS configuration was found.

View Source
var ErrNoCertificatesConfigured = errors.New("no tls configuration was found")

ErrNoCertificatesConfigured is returned when no TLS configuration was found.

Functions

func CreateSelfSignedCertificate

func CreateSelfSignedCertificate(key interface{}, organizations []string, commonName string) (cert *x509.Certificate, err error)

CreateSelfSignedCertificate creates a self-signed x509 certificate. key is parsed by PublicKey()

func CreateSelfSignedTLSCertificate

func CreateSelfSignedTLSCertificate(key interface{}, organizations []string, commonName string) (*tls.Certificate, error)

CreateSelfSignedTLSCertificate creates a self-signed TLS certificate. key is parsed by PublicKey()

func LoadCertificate

func LoadCertificate(
	certString, keyString string,
	certPath, keyPath string,
) ([]tls.Certificate, error)

LoadCertificate returns loads a TLS LoadCertificate by looking at environment variables. certString: Base64 encoded (without padding) string of the TLS certificate (PEM encoded) to be used for HTTP over TLS (HTTPS). Example: certString="-----BEGIN CERTIFICATE-----\nMIIDZTCCAk2gAwIBAgIEV5xOtDANBgkqhkiG9w0BAQ0FADA0MTIwMAYDVQQDDClP..." keyString: Base64 encoded (without padding) string of the private key (PEM encoded) to be used for HTTP over TLS (HTTPS). Example: keyString="-----BEGIN ENCRYPTED PRIVATE KEY-----\nMIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDg..." certPath: The path to the TLS certificate (pem encoded). Example: certPath=~/cert.pem keyPath: The path to the TLS private key (pem encoded). Example: keyPath=~/key.pem

func PEMBlockForKey

func PEMBlockForKey(key interface{}) (*pem.Block, error)

PEMBlockForKey returns a PEM-encoded block for key. key is parsed by PublicKey()

func PublicKey

func PublicKey(key interface{}) interface{}

PublicKey returns the public key for a given key or nul.

Types

This section is empty.

Jump to

Keyboard shortcuts

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