Documentation ¶
Overview ¶
Package crypto provides functions to for cryptography and random numbers.
Index ¶
- Constants
- func DeriveKey(secret, salt, info []byte, length uint) ([]byte, error)
- func GenerateCertificateSerialNumber() (*big.Int, error)
- func GenerateRandomBytes(length int) ([]byte, error)
- func PemToX509Cert(raw []byte) (*x509.Certificate, error)
- func X509CertToPem(cert *x509.Certificate) ([]byte, error)
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 GenerateCertificateSerialNumber ¶
GenerateCertificateSerialNumber generates a random serial number for an X.509 certificate.
func GenerateRandomBytes ¶
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 ¶ added in v2.12.0
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. |
Click to show internal directories.
Click to hide internal directories.