crypto

package
v0.10.5 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptField

func DecryptField(value string, key []byte) (string, error)

DecryptField decrypts an "enc:v1:<base64>" value back to plaintext. Returns "" for empty input. Returns the value as-is if it lacks the "enc:" prefix (legacy plaintext — lazy migration on next write). Logs a warning for unencrypted values to track migration progress.

func DeriveKey

func DeriveKey(secret string) ([]byte, error)

DeriveKey derives a 32-byte AES-256 key from the given secret using HKDF-SHA256. The info parameter provides domain separation per NIST SP 800-56C.

func EncryptField

func EncryptField(plaintext string, key []byte) (string, error)

EncryptField encrypts a plaintext string and returns "enc:v1:<base64>" format. Returns "" for empty input (no credential configured).

Types

This section is empty.

Jump to

Keyboard shortcuts

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