crypto

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: AGPL-3.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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
	// DEKPrefix is the prefix used to prefix DEK IDs. Originally introduced as a requirement for the HKDF info parameter.
	DEKPrefix = "key-"
	// MeasurementSecretKeyID is name used for the measurementSecret DEK.
	MeasurementSecretKeyID = "measurementSecret"
)

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 as an x.509 certificate.

func X509CertToPem

func X509CertToPem(cert *x509.Certificate) ([]byte, error)

X509CertToPem takes an x.509 certificate and returns it as a PEM-encoded certificate.

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