Documentation ¶
Index ¶
- func ComputeHmac256(tags []byte, key []byte) []byte
- func CreateEphemeralKey(curve func() elliptic.Curve, pub *ecdsa.PublicKey) (*ecdsa.PrivateKey, []byte)
- func GenerateRandomBytes(n int) ([]byte, error)
- func GenerateRandomString(s int) (string, error)
- func LoadAndVerifyCertificate(certPEM []byte, roots *x509.CertPool) (*x509.Certificate, error)
- func LoadAndVerifyECSecrets(keyPEM, certPEM, caCertPEM []byte) (key *ecdsa.PrivateKey, cert *x509.Certificate, rootCertPool *x509.CertPool, ...)
- func LoadEllipticCurveKey(keyPEM []byte) (*ecdsa.PrivateKey, error)
- func LoadRootCertificates(rootPEM []byte) *x509.CertPool
- func VerifyHmac(tags []byte, expectedMAC []byte, key []byte) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeHmac256 ¶
ComputeHmac256 computes the HMAC256 of the message
func CreateEphemeralKey ¶
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 ¶
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 ¶
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 ¶
LoadAndVerifyCertificate parses, validates, and creates a certificate structure from a PEM buffer It must be provided with the a CertPool
func LoadAndVerifyECSecrets ¶
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 LoadEllipticCurveKey ¶
func LoadEllipticCurveKey(keyPEM []byte) (*ecdsa.PrivateKey, error)
LoadEllipticCurveKey parses and creates an EC key
func LoadRootCertificates ¶
LoadRootCertificates loads the certificates in the provide PEM buffer in a CertPool
Types ¶
This section is empty.