crypto

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

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

Index

Constants

View Source
const (
	// Pbkdf2Algorithm is the key for the pbkdf algorithm.
	Pbkdf2Algorithm = "pbkdf2-sha256-600000"
)
View Source
const (
	// ScryptAlgorithm is the registration name for the scrypt algorithm instance.
	ScryptAlgorithm = "scrypt-65536-8-1"
)

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, keySize int, 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.

Types

This section is empty.

Jump to

Keyboard shortcuts

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