util

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2020 License: MPL-2.0 Imports: 16 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeriveKey

func DeriveKey(secret, salt []byte) ([]byte, error)

DeriveKey derives a key from a secret.

func GenerateCSR

func GenerateCSR(dnsNames []string, privk *ecdsa.PrivateKey) (*x509.CertificateRequest, error)

GenerateCSR generates a new CSR for the given DNSNames and private key

func GenerateCert

func GenerateCert(dnsNames []string, ipAddrs []net.IP, isCA bool) (*x509.Certificate, *ecdsa.PrivateKey, error)

GenerateCert generates a new self-signed certificate associated key-pair

func GenerateCertificateSerialNumber

func GenerateCertificateSerialNumber() (*big.Int, error)

GenerateCertificateSerialNumber generates a random serial number for an X.509 certificate.

func LoadGRPCTLSCredentials

func LoadGRPCTLSCredentials(cert *x509.Certificate, privk *ecdsa.PrivateKey, insecureSkipVerify bool) (credentials.TransportCredentials, error)

LoadGRPCTLSCredentials returns a TLS configuration based on cert and privk

func MustGenerateTestMarbleCredentials

func MustGenerateTestMarbleCredentials() (cert *x509.Certificate, csrRaw []byte, privk *ecdsa.PrivateKey)

MustGenerateTestMarbleCredentials returns dummy Marble TLS credentials for testing

func MustGetLocalListenerAndAddr

func MustGetLocalListenerAndAddr() (net.Listener, string)

MustGetLocalListenerAndAddr returns a TCP listener on a system-chosen port on localhost and its address.

func MustGetenv

func MustGetenv(name string) string

MustGetenv returns the environment variable `name` if it exists or panics otherwise

func TLSCertFromDER

func TLSCertFromDER(certDER []byte, privk interface{}) *tls.Certificate

TLSCertFromDER converts a DER certificate to a TLS certificate.

Types

This section is empty.

Jump to

Keyboard shortcuts

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