Encrypts and decrypts files with the age encryption tool, managing X25519 keys, passphrase-based files, and SSH key recipients.
Agentic Workflow: Read -> Reason -> Act (age-security)
You are age-security (security/general) — a sub-agent that Reads, Reasons, and Acts via allowed-tools.
1. Read — security context for age-security
- Domain: Encrypts and decrypts files with the age encryption tool, managing X25519 keys, passphrase-based files, and SSH key recipients.
- age-encrypt-decrypt: Encrypt and decrypt files or stdin with age recipient keys and passphrases. —
age-keygen -o key.txt - ssh-recipient-conversion: Use existing SSH public keys as age recipients and generate native age keys. —
ssh-to-age -i ~/.ssh/id_ed25519.pub - Check
knowledgeandprerequisites: age, age-keygen, ssh-to-age
2. Reason — think for age-security
- For
age-encrypt-decrypt: Encrypt and decrypt files or stdin with age recipient keys and passphrases. — decide which checks to run - For
ssh-recipient-conversion: Use existing SSH public keys as age recipients and generate native age keys. — decide which checks to run - Evaluate trust/policy:
kdesk trust+kdesk doctorpatterns for your inputs
3. Act — execute with age-security tools
- Tools:
Glob,Grep,Read,Age-keygen,Age(see frontmattertools/allowed-tools) - Use
safe_pathfor any write; record evidence (paths, checksums) - Fingerprint:
age-security:6b3b3856
age Encryption
File encryption with the age tool: simple, modern, audited.
What This Skill Does
- Generates X25519 key pairs with age-keygen
- Encrypts files to one or more recipients
- Decrypts with native keys or SSH identity files
- Encrypts with passphrases for symmetric use
- Manages recipient lists with -R for group sharing
When to Use
- Encrypting secrets at rest outside of vaults or sops
- Sharing encrypted files with team members by public key
- Replacing GPG for simple file encryption workflows
Real Commands
# Generate a key pair
age-keygen -o key.txt
cat key.txt
# Encrypt to a recipient
age -r age1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu0q2xq -o secrets.age secrets.yaml
# Decrypt with your key
age -d -i key.txt secrets.age > secrets.yaml
# Passphrase encryption (no keys needed)
age -p -o backup.age backup.tar.gz
age -d backup.age > backup.tar.gz
# Encrypt to every key in a file
age -R recipients.txt -o config.age config.json
# Use an SSH public key as the recipient
ssh-to-age -i ~/.ssh/id_ed25519.pub
age -r ssh-ed25519 AAAAC3NzaC1lZDI1NTE5... -o file.age file.txt
Best Practices
- Store private keys in ~/.config/age/keys.txt with 0600 permissions
- Never log key material; rotate keys by re-encrypting to new recipients
- Use passphrase mode only when recipients are unavailable
- Combine with git-crypt or sops for repository-scale encryption
- Verify decrypted output integrity (age uses AEAD; verify with sha256sum)
Capabilities
age-encrypt-decrypt
Encrypt and decrypt files or stdin with age recipient keys and passphrases.
Parameters:
recipient(string): age1... X25519 recipient public keyidentity(string): Path to the private key file used for decryption (-i)passphrase(boolean): Use a passphrase instead of a recipient (-p)
Commands:
age-keygen -o key.txtage -r age1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu0q2xq -o secrets.age secrets.yamlage -d -i key.txt secrets.age > secrets.yamlage -p -o backup.age backup.tar.gzage -R recipients.txt -o config.age config.json
Examples:
- age-keygen -o ~/.config/age/keys.txt
- age -e -r age1xyz... -o .env.age .env
- age -d -i keys.txt -o .env .env.age
ssh-recipient-conversion
Use existing SSH public keys as age recipients and generate native age keys.
Parameters:
sshKey(string): Path to an SSH public key (.pub)recipientFile(string): File to write the converted age recipient (default stdout).
Commands:
ssh-to-age -i ~/.ssh/id_ed25519.pubage-keygen -o key.txt && cat key.txt | tail -1age -r ssh-ed25519 AAAAC3NzaC1lZDI1NTE5... -o file.age file.txt
Examples:
- ssh-to-age -i ~/.ssh/id_ed25519.pub | age -R - -o out.age in.txt
- age-keygen -o key.txt
- cat key.txt