age

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(ciphertext []byte, passphrase string) ([]byte, error)

Decrypt decrypts ciphertext using a scrypt passphrase.

func DerivePassphrase

func DerivePassphrase(passphrase string, keyfileContent []byte) (string, error)

DerivePassphrase combines a passphrase with keyfile content using HKDF-SHA256, returning a hex-encoded 32-byte derived key suitable for use as an age passphrase.

func Encrypt

func Encrypt(plaintext []byte, passphrase string) ([]byte, error)

Encrypt encrypts plaintext using a scrypt passphrase.

func KeyfileFingerprint

func KeyfileFingerprint(content []byte) string

KeyfileFingerprint returns the SHA-256 fingerprint of keyfile content.

func ReadPassphrase

func ReadPassphrase(prompt string) (string, error)

ReadPassphrase prompts the user and reads a passphrase with echo disabled. When stdin is not a terminal (e.g. piped input), the passphrase is read from /dev/tty instead, matching the behavior of GPG and SSH.

func ReadPassphraseConfirm

func ReadPassphraseConfirm(prompt ...string) (string, error)

ReadPassphraseConfirm prompts for a passphrase twice and verifies they match. An optional prompt can be provided for the first prompt; defaults to "Enter passphrase: ".

Types

This section is empty.

Jump to

Keyboard shortcuts

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