crypto

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// KeySize is the size of AES-256 keys in bytes
	KeySize = 32
	// NonceSize is the size of AES-GCM nonces in bytes
	NonceSize = 12
	// SaltSize is the size of PBKDF2 salts in bytes
	SaltSize = 32
	// PBKDF2Iterations is the number of iterations for key derivation
	PBKDF2Iterations = 100000
)

Variables

This section is empty.

Functions

func DeriveColumnKey

func DeriveColumnKey(masterKey []byte, columnName string, salt []byte) []byte

DeriveColumnKey derives a column-specific key from master key and column name

Types

type ColumnEncryptor

type ColumnEncryptor struct {
	// contains filtered or unexported fields
}

ColumnEncryptor handles encryption/decryption for column data

func NewColumnEncryptor

func NewColumnEncryptor(key []byte) (*ColumnEncryptor, error)

NewColumnEncryptor creates a new column encryptor with the given key

func (*ColumnEncryptor) Decrypt

func (ce *ColumnEncryptor) Decrypt(ciphertext []byte) ([]byte, error)

Decrypt decrypts data using AES-256-GCM

func (*ColumnEncryptor) Encrypt

func (ce *ColumnEncryptor) Encrypt(plaintext []byte) ([]byte, error)

Encrypt encrypts data using AES-256-GCM

type Key

type Key struct {
	Data []byte
	Salt []byte
}

Key represents an encryption key with associated metadata

func DeriveKey

func DeriveKey(password string, salt []byte) *Key

DeriveKey derives a key from password and salt

func NewKey

func NewKey(password string) (*Key, error)

NewKey generates a new encryption key from a password

Jump to

Keyboard shortcuts

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