credentials

package
v1.8.7 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2022 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// 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"
)

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