tls

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: BSD-2-Clause Imports: 12 Imported by: 5

Documentation

Overview

Package tls contains wrapper functions for creating GRPC credentials. It also implements RSA key parsing.

Package tls contains wrapper functions for creating GRPC credentials. It also implements RSA key parsing

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractPublicKey

func ExtractPublicKey(cert *x509.Certificate) (*rsa.PublicKey, error)

ExtractPublicKey pulls the certificate's public key from the certificate object If the public key is not an rsa key, it returns an error

func LoadCertificate

func LoadCertificate(certContents string) (*x509.Certificate, error)

LoadCertificate takes a pem encoded certificate (ie the contents of a crt file), parses it and outputs an x509 certificate object

func LoadRSAPrivateKey

func LoadRSAPrivateKey(privContents string) (*gorsa.PrivateKey, error)

LoadRSAPrivateKey takes a pem encoded private key (ie the contents of a private key file), parses it and outputs an x509 private key object

func NewCredentialsFromFile

func NewCredentialsFromFile(filePath string,
	nameOverride string) (credentials.TransportCredentials, error)

NewCredentialsFromFile creates a TransportCredentials object from the contents of a file. Accepts a nameOverride for use in test environments.

func NewCredentialsFromPEM

func NewCredentialsFromPEM(certificate string,
	nameOverride string) (credentials.TransportCredentials, error)

NewCredentialsFromPEM creates a TransportCredentials object out of a string. Accepts a nameOverride for use in test environments.

func NewPublicKeyFromFile

func NewPublicKeyFromFile(filePath string) (*rsa.PublicKey, error)

NewPublicKeyFromFile reads the contents of a file and uses it to create a PublicKey object.

func NewPublicKeyFromPEM

func NewPublicKeyFromPEM(certPEMblock []byte) (*rsa.PublicKey, error)

NewPublicKeyFromPEM accepts a PEM certificate block in []byte format and returns a *rsa.PublicKey object.

Types

This section is empty.

Jump to

Keyboard shortcuts

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