# Make an age key pair, and use it with the age encryption tool

> Make a key pair with the free in-browser tool or with age-keygen -pq=false, keep the secret key in a file only you can read, and use it with the age encryption tool to encrypt and decrypt.

Updated 2026-12-05 by SecureSecretStore.

SecureSecretStore is not open yet. Its design uses key pairs in the [age format](https://c2sp.org/age), of the classic
X25519 kind. This page shows two ways to make one and how to use it with the [age encryption tool](https://github.com/FiloSottile/age). The
`age-keygen` way works today; the free tool arrives shortly. Neither needs an account.

## What do I get?

Two lines of text:

| half | starts with | who sees it |
|---|---|---|
| public key (recipient) | `age1` | anyone you want to receive encrypted values from |
| secret key (identity) | `AGE-SECRET-KEY-1` | only the device that made it |

A value encrypted to the public key opens only with the secret key. The public key can be posted anywhere. The secret
key should never leave the device that made it.

## Way 1: the free tool in your browser

1. Open the free key tools on the [home page](https://securesecretstore.com/) and choose **Make an age key pair**.
2. The tool shows the public key, the secret key hidden behind **Show**, and the key's fingerprint.
3. Run the tool on the device that will use the key, and save the secret key there with Copy or Download.

The key is made in your browser by a WebAssembly module, and nothing is sent. You can check that yourself: open your
browser's developer tools on the Network tab, make a key and watch that no request goes out, or load the page, turn
off your network, and make a key offline.

## Way 2: `age-keygen` on the command line

Install the age encryption tool. On macOS, `brew install age`; on Debian 12 or later and Ubuntu 22.04 or later,
`apt install age`; on Windows, `winget install --id FiloSottile.age`. The
[project's README](https://github.com/FiloSottile/age#installation) lists every other package and the pre-built
binaries.

Check which version you have, because the right command depends on it:

```sh
age --version
```

| version | to make an X25519 key pair |
|---|---|
| 1.4.0 or later | `age-keygen -pq=false -o key.txt` |
| 1.3.x | `age-keygen -o key.txt` (classic is the default) |
| 1.2.1 or earlier | `age-keygen -o key.txt` (only classic keys exist) |

[Version 1.4.0](https://github.com/FiloSottile/age/releases/tag/v1.4.0), released on 1 December 2026, changed the
default: `age-keygen` with no flags now makes a post-quantum hybrid key, whose public key starts with `age1pq1` and is
about 2,000 characters long. Versions 1.2.1 and earlier stop with `flag provided but not defined: -pq` if you pass the
flag.

On version 1.4.0:

```console
$ age-keygen -pq=false -o key.txt
Public key: age1zclk3f7hzjsdzxdp7flytqdjz5ltyjfu34mcphjr9fsa2vxyq3hsjyech8
$ cat key.txt
# created: 2026-12-05T20:17:58Z
# public key: age1zclk3f7hzjsdzxdp7flytqdjz5ltyjfu34mcphjr9fsa2vxyq3hsjyech8
AGE-SECRET-KEY-1…
```

The file holds the secret key, with the public key in a comment. With `-o`, `age-keygen` creates the file readable only
by you (mode `600` on macOS and Linux) and refuses to overwrite one that exists. Keep it that way.

Lost the public key? Get it back from the secret key at any time:

```sh
age-keygen -y key.txt
```

## Check the key

Paste the public key into **Check a key's fingerprint** on the [home page](https://securesecretstore.com/), or run the script on
[Check a fingerprint](https://securesecretstore.com/help/check-a-fingerprint):

```console
$ python3 age-fingerprint.py "$(age-keygen -y key.txt)"
05c6 f091 667b d9bc caf0 bd0a 496d 871d
```

The free tool and the script must show the same 8 groups for the same key.

## Encrypt and decrypt a test value

Encrypt to the public key with `-r`, decrypt with the secret key file with `-i`:

```sh
printf 'sk_test_example_value\n' | age -r "$(age-keygen -y key.txt)" -o test.age
age -d -i key.txt test.age
```

The second command prints `sk_test_example_value`. Version 1.4.0 also prints this on both commands, because the key is
a classic one:

```text
age: warning: the encrypted file could be decrypted by a future quantum computer, see https://age-encryption.org/pq-warning
```

The linked page is the age project's explanation.

To see what the encrypted file says about itself without decrypting it, use `age-inspect` (version 1.3.0 and later):

```console
$ age-inspect test.age
test.age is an age file, version "age-encryption.org/v1".

This file is encrypted to the following recipient types:
  - "X25519"

This file does NOT use post-quantum encryption.
…
```

It goes on with a size breakdown: the header, the encryption overhead, and the exact length of the value.

## Encrypt to several readers at once

Put one public key per line in a recipients file. Lines starting with `#` are comments:

```text
# laptop
age1zclk3f7hzjsdzxdp7flytqdjz5ltyjfu34mcphjr9fsa2vxyq3hsjyech8
# phone
age10mmamr9j8j7wsjpw6lqvyl33zf8uw2qk5cxsazea56z2jguetflsm5e68l
# recovery kit
age1z55r3z88f67sp5nv4leaajmehah4haus8hcdd37lx8e5wxwp9pksw5hht2
```

```sh
printf 'sk_test_example_value\n' | age -R readers.txt -o shared.age
```

Any one of the three secret keys now decrypts `shared.age`. This is the same thing SecureSecretStore is designed to do
for every version of a secret: one encrypted value, wrapped once for each reader's key. See
[How the encryption works](https://securesecretstore.com/help/how-encryption-works).

You cannot mix kinds. Versions 1.3.0 and later refuse to encrypt to a classic key and a post-quantum key in the same
file, because the classic one would undo the post-quantum protection:

```text
age: error: incompatible recipients: can't mix post-quantum and classic recipients, or the file would be vulnerable to quantum computers
```

## Where should the secret key live?

- **On a laptop or server:** a file only your user can read, outside any repository. Add it to `.gitignore` if it sits
  near one.
- **In the browser:** SecureSecretStore's web app is designed to keep it encrypted under a key the page cannot export.
- **For an AI agent:** in the agent runtime's own secret storage, readable by the code that calls other services and
  never placed in the model's prompt. See
  [How to give an AI agent an API key without putting it in the prompt](https://securesecretstore.com/articles/ai-agent-api-keys-outside-the-prompt).

Make one key pair per device. If one secret key is copied to several machines, losing any one of them exposes all of
them. [A key per device, and the recovery kit](https://securesecretstore.com/help/devices-and-recovery-kit) explains how devices are added and
removed.

For more on the format itself, including the post-quantum keys, read
[What is an age key, and how do I make one?](https://securesecretstore.com/articles/what-is-an-age-key).

## Links

- This page for people: https://securesecretstore.com/help/make-an-age-key-pair
- Every AI version on this site: https://securesecretstore.com/llms.txt

How little we track: no tracking scripts, no third-party scripts, no ad or analytics cookies. https://securesecretstore.com/privacy.md
