📥 How to import GPG keys

📆 2026-10-06 08:05

Keeping a backup of your GPG key is important, especially if you use it for signing files, emails, or encrypting data. Losing your private key can mean losing access to encrypted files that only that key can decrypt. If you haven't already create a backup for your key you can read:

📤 How to export GPG keys

If you already have your backup then it's time to move on.

Restore an encrypted backup

GPG will ask for the passphrase you used when creating the encrypted backup. After importing the key, check that it is present:

You should see your primary key and encryption subkey.

Restore an unencrypted backup

If your backup is an unencrypted private.asc file, simply run:

Then check the keyring again:

Test the restored key

You can make sure the restored signing key works by signing a small test file:

This creates test.txt.asc. Verify the signature with:

If GPG reports a Good signature, your key has been successfully restored.

If this tutorial saved you time, sanity, or a mild existential crisis... consider fueling future chaos with a small donation:

☕ Buy me a Ko-Fi

🔐 How to use GPG keys

🎓 Back to my tutorials

🚶 Back to my homepage