# Age Security

> Encrypts and decrypts files with the age encryption tool, managing X25519 keys, passphrase-based files, and SSH key recipients. Use when working with age encrypt decrypt, ssh recipient conversion, security or when the user mentions age encrypt decrypt, ssh recipient conversion, security.

- Skill: `opknock/age-security` (Agent Skill)
- Install (CLI): `npx get-skill add opknock/age-security`
- Raw SKILL.md: https://api.skillmd.com/api/skills/opknock/age-security/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Security
- License: MIT
- Author: OpKnock (https://skillmd.com/u/opknock)
- Updated: 2026-11-23
- Page: https://skillmd.com/skills/opknock/age-security

---


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 `knowledge` and `prerequisites: 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 doctor` patterns for your inputs

### 3. Act — execute with `age-security` tools
- Tools: `Glob`, `Grep`, `Read`, `Age-keygen`, `Age` (see frontmatter `tools`/`allowed-tools`)
- Use `safe_path` for 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

```bash
# 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 key
- `identity` (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.txt`
- `age -r age1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu0q2xq -o secrets.age secrets.yaml`
- `age -d -i key.txt secrets.age > secrets.yaml`
- `age -p -o backup.age backup.tar.gz`
- `age -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.pub`
- `age-keygen -o key.txt && cat key.txt | tail -1`
- `age -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

## References
- [age Specification](https://age-encryption.org/v1)
- [age GitHub Repository](https://github.com/FiloSottile/age)

