trireme-lib: go.aporeto.io/trireme-lib/utils/crypto Index | Files

package crypto

import "go.aporeto.io/trireme-lib/utils/crypto"

Index

Package Files

crypto.go

func ComputeHmac256 Uses

func ComputeHmac256(tags []byte, key []byte) ([]byte, error)

ComputeHmac256 computes the HMAC256 of the message

func CreateEphemeralKey Uses

func CreateEphemeralKey(curve func() elliptic.Curve, pub *ecdsa.PublicKey) (*ecdsa.PrivateKey, []byte)

CreateEphemeralKey creates an ephmeral private/public key based on the provided public key and the corresponding elliptic curve

func GenerateRandomBytes Uses

func GenerateRandomBytes(n int) ([]byte, error)

GenerateRandomBytes returns securely generated random bytes. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.

func GenerateRandomString Uses

func GenerateRandomString(s int) (string, error)

GenerateRandomString returns a URL-safe, base64 encoded securely generated random string. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.

func LoadAndVerifyCertificate Uses

func LoadAndVerifyCertificate(certPEM []byte, roots *x509.CertPool) (*x509.Certificate, error)

LoadAndVerifyCertificate parses, validates, and creates a certificate structure from a PEM buffer It must be provided with the a CertPool

func LoadAndVerifyECSecrets Uses

func LoadAndVerifyECSecrets(keyPEM, certPEM, caCertPEM []byte) (key *ecdsa.PrivateKey, cert *x509.Certificate, rootCertPool *x509.CertPool, err error)

LoadAndVerifyECSecrets loads all the certificates and keys to memory in the right data structures

func LoadCertificate Uses

func LoadCertificate(certPEM []byte) (*x509.Certificate, error)

LoadCertificate loads a certificate from a PEM file without verifying Should only be used for loading a root CA certificate. It will only read the first certificate

func LoadEllipticCurveKey Uses

func LoadEllipticCurveKey(keyPEM []byte) (*ecdsa.PrivateKey, error)

LoadEllipticCurveKey parses and creates an EC key

func LoadRootCertificates Uses

func LoadRootCertificates(rootPEM []byte) *x509.CertPool

LoadRootCertificates loads the certificates in the provide PEM buffer in a CertPool

func VerifyHmac Uses

func VerifyHmac(tags []byte, expectedMAC []byte, key []byte) bool

VerifyHmac verifies if the HMAC of the message matches the one provided

Package crypto imports 13 packages (graph) and is imported by 9 packages. Updated 2018-11-15. Refresh now. Tools for package owners.