Skip to the tool workspace
Browser 143

Handleidingen Keys and encryption

How to generate a PGP key pair

Make an OpenPGP key pair in your browser: which algorithm, expiry and passphrase to choose, what the tool does to keep the key safe, how to back it up, and when GnuPG is the better choice.

A PGP key pair is two files that stay with you for years: a public key you give to anyone, and a private key that is the only thing stopping someone from signing as you. Making one takes about a minute in the browser. Making one you won't regret takes a little thought about four choices, and that is what most of this guide covers.

PGP Key Generator filled in: the user ID Ada Lovelace <ada@example.com>, Curve25519 chosen and marked Recommended, and an expiry of two years

The whole key on one form: who it is for, the algorithm and the expiry, with the passphrase below.

Make the key
  1. Fill in your name and the email address people will write to. The User ID line under them is exactly what goes into the key.
  2. Leave Curve25519 selected and pick In two years under Expires.
  3. Type a passphrase, or press Generate a strong passphrase for six random words and write them down.
  4. Press Generate key pair. Curve25519 takes about a second.
  5. Save all three files the page offers: the public key, the private key and the revocation certificate. The next sections say where each one goes.
PGP Key Generator after a run: The key that was made, with the user ID, the full fingerprint, Curve25519 and the expiry date, then the public key with Copy and Save file

The fingerprint is read back from the file you are about to save, not from the form.

The four choices

Algorithm

Take Curve25519. GnuPG calls the signing half ed25519, and it is the default in current versions. It is fast, the keys are small enough to paste into an email, and it is here to stay.

Pick RSA 3072 or RSA 4096 only when something you have to work with can't read anything else. That is rare now. Choose it because a specific piece of software forces you to, not because bigger sounds safer. RSA 4096 can take a minute or more in the tab, and you see a timer rather than a progress bar, because the prime search inside it reports nothing until it is done.

Expiry

Set one. Two years is a reasonable default.

An expiry date is not a deadline, it is a dead-man's switch. If you lose the laptop, forget the passphrase or stop using PGP, the key retires itself. It won't sit on a keyserver forever, looking valid, while people encrypt things you will never read. You can push the date back at any time while you hold the private key, so setting one costs you nothing.

Identity

The name and email become the key's user ID, and they are public. Use the address people will actually write to. You can add more addresses to the same key later. You don't need a key per address.

Passphrase

The private key file alone is not enough to be you. The passphrase is the other half. Use a long one you can type from memory, keep it in your password manager, and know that there is no recovery. Lose it and the key is gone.

The drawn passphrase is six words picked from a list of 5,495 with the browser's cryptographic random source (crypto.getRandomValues), which is about 74 bits. It is shown in the clear with no confirm box, because you didn't type it, so there is nothing to check. Write it down before you press Generate.

What the tool does to keep it safe

Generating a key is the step where a careless tool does the most damage, so here is exactly what this one does:

  • The key is made in the tab. openpgp.js runs in a background worker. There is no server step, so there is nothing to upload your key, your passphrase or your name to.
  • No passphrase, no key. The tool refuses to make an unprotected private key, and it checks the finished key is locked before it shows it to you.
  • The passphrase is never stored. It is held for the one operation and dropped with its worker.
  • The fingerprint is read from the file. What you see on screen is parsed back from the armored key you are about to save, so the two can't differ.
  • The revocation certificate is offered once and kept nowhere. Stored next to the key, it would be in reach of exactly the wrong person.
  • Keeping the key in this browser is your choice. Keep this key stores the passphrase-locked private key in this browser's storage, so the other PGP tools can use it. Clearing browser data removes it, and nothing else holds a copy, so save the file either way.
Generate it on a machine you trust

A key is only as trustworthy as the computer that made it. A shared or compromised machine makes a key you can't rely on, whether it came from a browser tab, gpg or anything else. No tool can fix this part for you.

Back up the three files

The page gives you three text files, and each goes somewhere different:

  • The public key (-----BEGIN PGP PUBLIC KEY BLOCK-----) is what you give people. There is nothing secret in it.
  • The private key (-----BEGIN PGP PRIVATE KEY BLOCK-----) is what you back up, somewhere offline. It is still encrypted with your passphrase. That is what makes copying it to a USB stick uncomfortable rather than reckless.
  • The revocation certificate is how you announce that the key is dead, after a stolen laptop or a forgotten passphrase. You can't make one later without the private key and its passphrase, and losing those is exactly when you will need it.
Back it up now, not later
  1. Put the revocation certificate somewhere other than the machine holding the key, such as a password manager attachment or an offline drive.
  2. Copy the private key file to the same place.
  3. Store the passphrase separately from both.

Anyone with the revocation certificate can retire your key, so treat it as carefully as the private key. Keep it. Don't publish it.

Using the key with GnuPG later

The result is an ordinary OpenPGP key. On a machine with GnuPG it imports like any other, encryption subkey and expiry included:

gpg --import ada-private.asc
gpg --list-secret-keys --keyid-format=long
sec   ed25519/6F58B05C3DFB1196 2026-10-20 [SC] [expires: 2028-10-19]
      D6DD64DABDCACC0B48F830696F58B05C3DFB1196
uid                 [ unknown] Ada Lovelace <[email protected]>
ssb   cv25519/5CF6FB0C2B3CAFB4 2026-10-20 [E] [expires: 2028-10-19]

[SC] is the main key, for signing and certifying. The ssb line marked [E] is the encryption subkey that lets people encrypt to you. The long hex string on the second line is the fingerprint: the only form of the key's identity worth reading out loud or comparing in person. Short key IDs can be forged. Fingerprints can't.

GnuPG 2.4 also prints a warning that the key "contains preferences for unavailable algorithms", digest algorithms 14 and 12. Those are SHA3-512 and SHA3-256, which the key lists among the hashes it accepts and GnuPG 2.4 doesn't implement. It is harmless: GnuPG picks the next hash on the list. The gpg --edit-key … updpref save command in the warning rewrites the list if you want it gone.

The direct wayGnuPGmacOS · Linux · Windows

When GnuPG is the better choice: a key you'll keep for years and use from a mail client, git or pass, which all read GnuPG's keyring; or a key whose main half you want offline, with subkeys on a hardware token. The browser tool makes one key with one encryption subkey and doesn't manage subkeys or tokens.

gpg --quick-generate-key "Ada Lovelace <[email protected]>" default default 2y

Write default for the algorithm, not ed25519. Naming ed25519 there makes a key that can only sign, with no encryption subkey. GnuPG writes the revocation certificate to ~/.gnupg/openpgp-revocs.d/ and barely mentions it; copy it out the same way.

What to do next

You have a key pair, but nobody can use it yet. Publish the public key where the people who write to you will look (your website, your email signature, a keyserver), and give out the fingerprint in person when it matters.

Then use it. Signing a message proves it came from you. Encrypting one means only the holder of the matching private key can read it.

Questions people ask

Is generating a key in a browser safe?

The key is made by openpgp.js in a background worker in the tab, and nothing is uploaded: there is no server step to upload to. The tool won't make a key without a passphrase and never stores the passphrase. What no tool can fix is the machine: a computer you don't trust makes a key you can't trust, whether it came from a browser tab or from gpg.

Should I use Curve25519 or RSA?

Curve25519, unless something you have to work with can't read it. It is faster, the keys are far smaller, and it is the default in current GnuPG. Choose RSA only when a specific piece of software demands it.

Do I really need an expiry date?

Yes. An expiry date is a dead-man's switch: if you ever lose access to the key, it stops being valid on its own. You can extend it at any time with the private key, so setting one costs you nothing.

Can I use a browser-generated key with GnuPG later?

Yes. The private key is standard ASCII-armored OpenPGP, and gpg --import takes it with the encryption subkey and the expiry intact. We checked it with GnuPG 2.4.7.

Why does gpg warn about digest algorithm 14 and 12 when I import it?

The key says it prefers SHA3-512 and SHA3-256 among other hashes, and GnuPG 2.4 doesn't implement SHA-3. The warning is harmless: GnuPG uses the next hash on the list. Run the gpg --edit-key command it prints if you want the warning gone.

What happens if I lose the passphrase?

The private key is gone for good. There is no reset. That is why the revocation certificate matters: it is how you tell the world to stop using a key you no longer control.

Tools in deze handleiding

Alles draait op je apparaat

Alle handleidingen First published 9 sep. 2026