credentials

package
v1.0.1-0...-f351835 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RootCertFilename is the filename that holds the root certificate
	RootCertFilename = "ca.crt"
	// IssuerCertFilename is the filename that holds the issuer certificate
	IssuerCertFilename = "issuer.crt"
	// IssuerKeyFilename is the filename that holds the issuer key
	IssuerKeyFilename = "issuer.key"
)

Variables

This section is empty.

Functions

func GetClientOptions

func GetClientOptions(certChain *CertChain, serverName string) ([]grpc.DialOption, error)

func GetServerOptions

func GetServerOptions(certChain *CertChain) ([]grpc.ServerOption, error)

func TLSConfigFromCertAndKey

func TLSConfigFromCertAndKey(certPem, keyPem []byte, serverName string, rootCA *x509.CertPool) (*tls.Config, error)

TLSConfigFromCertAndKey return a tls.config object from valid cert/key pair in PEM format.

Types

type CertChain

type CertChain struct {
	RootCA []byte
	Cert   []byte
	Key    []byte
}

CertChain holds the certificate trust chain PEM values

func LoadFromDisk

func LoadFromDisk(rootCertPath, issuerCertPath, issuerKeyPath string) (*CertChain, error)

LoadFromDisk retruns a CertChain from a given directory

type TLSCredentials

type TLSCredentials struct {
	// contains filtered or unexported fields
}

TLSCredentials holds paths for credentials

func NewTLSCredentials

func NewTLSCredentials(path string) TLSCredentials

NewTLSCredentials returns a new TLSCredentials

func (*TLSCredentials) CertPath

func (t *TLSCredentials) CertPath() string

CertPath returns the file path for the cert

func (*TLSCredentials) KeyPath

func (t *TLSCredentials) KeyPath() string

KeyPath returns the file path for the cert key

func (*TLSCredentials) Path

func (t *TLSCredentials) Path() string

Path returns the directory holding the TLS credentials

func (*TLSCredentials) RootCertPath

func (t *TLSCredentials) RootCertPath() string

RootCertPath returns the file path for the root cert

Jump to

Keyboard shortcuts

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