crypto

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package crypto implements common symmetric-encryption and key-derivation functions.

Index

Constants

View Source
const (
	// MasterKeyLength describes the length of the master key.
	MasterKeyLength = 32

	// ScryptAlgorithm is the key for the scrypt algorithm.
	ScryptAlgorithm = "scrypt-65536-8-1"
	// Pbkdf2Algorithm is the key for the pbkdf algorithm.
	Pbkdf2Algorithm = "pbkdf2"
)
View Source
const DefaultKeyDerivationAlgorithm = ScryptAlgorithm

DefaultKeyDerivationAlgorithm is the key derivation algorithm for new configurations.

Variables

This section is empty.

Functions

func DecryptAes256Gcm

func DecryptAes256Gcm(data, masterKey, salt []byte) ([]byte, error)

DecryptAes256Gcm encrypts data with AES 256 GCM.

func DeriveKeyFromMasterKey

func DeriveKeyFromMasterKey(masterKey, salt, purpose []byte, length int) []byte

DeriveKeyFromMasterKey computes a key for a specific purpose and length using HKDF based on the master key.

func DeriveKeyFromPassword

func DeriveKeyFromPassword(password string, salt []byte, algorithm string) ([]byte, error)

DeriveKeyFromPassword derives encryption key using the provided password and per-repository unique ID.

func EncryptAes256Gcm

func EncryptAes256Gcm(data, masterKey, salt []byte) ([]byte, error)

EncryptAes256Gcm encrypts data with AES 256 GCM.

func RegisterKeyDerivationFunc added in v0.16.0

func RegisterKeyDerivationFunc(name string, keyDeriver keyDerivationFunc)

RegisterKeyDerivationFunc registers various key derivation functions.

Types

This section is empty.

Jump to

Keyboard shortcuts

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