crypto

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2022 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package crypto provides functions to for cryptography and random numbers.

Index

Constants

View Source
const (
	// StateDiskKeyLength is key length in bytes for node state disk.
	StateDiskKeyLength = 32
	// DerivedKeyLengthDefault is the default length in bytes for KMS derived keys.
	DerivedKeyLengthDefault = 32
	// MasterSecretLengthDefault is the default length in bytes for CLI generated master secrets.
	MasterSecretLengthDefault = 32
	// MasterSecretLengthMin is the minimal length in bytes for user provided master secrets.
	MasterSecretLengthMin = 16
	// RNGLengthDefault is the number of bytes used for generating nonces.
	RNGLengthDefault = 32
	// HKDFInfoPrefix is the prefix used for the info parameter in HKDF.
	HKDFInfoPrefix = "key-"
)

Variables

This section is empty.

Functions

func DeriveKey

func DeriveKey(secret, salt, info []byte, length uint) ([]byte, error)

DeriveKey derives a key from a secret.

func GenerateCertificateSerialNumber

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

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

func GenerateRandomBytes

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

GenerateRandomBytes reads length bytes from getrandom(2) if available, /dev/urandom otherwise.

func PemToX509Cert

func PemToX509Cert(raw []byte) (*x509.Certificate, error)

PemToX509Cert takes a list of PEM encoded certificates, parses the first one and returns it.

Types

This section is empty.

Directories

Path Synopsis
Package testvector provides test vectors for key derivation and crypto functions.
Package testvector provides test vectors for key derivation and crypto functions.

Jump to

Keyboard shortcuts

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