crypto

package
v0.1.39 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const KeyFileSize = 32 // 256 bits for AES-256
View Source
const ThreeNcrPrefix = "3ncr.org/1#"

ThreeNcrPrefix is the header of the 3ncr.org/1 encrypted-string format that all new encryptions use. Stored values without it are in the legacy format (base64url of AES-256-GCM nonce||ciphertext||tag, as written by ODDK <= 0.1.28 via cryptopasta); the daemon re-encrypts those at startup, and DecryptPassword keeps a legacy fallback for rows that pre-date the sweep.

Variables

This section is empty.

Functions

func DecryptPassword

func DecryptPassword(encryptedPassword string, masterKey []byte) (string, error)

DecryptPassword decrypts a stored value with the master key, handling both the 3ncr.org/1 format and the legacy pre-0.1.29 format.

func EncryptPassword

func EncryptPassword(password string, masterKey []byte) (string, error)

EncryptPassword encrypts a password with the master key in the 3ncr.org/1 format (AES-256-GCM with the raw 32-byte key, self-describing header).

func GetOrCreateKeyFile

func GetOrCreateKeyFile(dataDir string) ([]byte, error)

GetOrCreateKeyFile gets or creates the master key file

func IsLegacyCiphertext

func IsLegacyCiphertext(stored string) bool

IsLegacyCiphertext reports whether a stored value is in the legacy format and should be re-encrypted (used by the daemon's startup sweep).

Types

This section is empty.

Jump to

Keyboard shortcuts

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