OpenPGP Decryption Guide
Decrypt PGP-encrypted messages and files using your private key — with passphrase protection.
Published:
Tags: OpenPGP decryption, PGP decrypt online, GPG decrypt message
--BEGIN PGP MESSAGE----------END PGP MESSAGE-----.gpg.asc-----BEGIN PGP MESSAGE-----.gpggpg --list-secret-keys --keyid-format LONG--verify--decrypt.sig-----BEGIN PGP PUBLIC KEY BLOCK-----gpg --decrypt message.ascopenpgp.decryptKey({ privateKey, passphrase })openpgp.decrypt({ message, decryptionKeys })gpg --import private.ascgpg --decrypt file.ascgpg --armor --export you@email.com.gpg` files contain the same data, ~25% smaller.
Frequently Asked Questions
How do I decrypt a PGP message?
You need your private key and its passphrase. In GPG: `gpg --decrypt message.asc`. GPG will automatically locate your private key in the keyring if the message was encrypted to your key ID. In openpgp.js, use `openpgp.decrypt({ message, decryptionKeys })` after unlocking your private key with the passphrase.
How do I use my private key for decryption?
Import your private key with `gpg --import private.asc` if it is not already in your keyring. Then run `gpg --decrypt encrypted_file.asc`. You will be prompted for your key passphrase. If using openpgp.js, read the private key with `openpgp.readPrivateKey({ armoredKey })`, then unlock it with `openpgp.decryptKey({ privateKey, passphrase })`.
What does GPG decrypt do?
GPG decryption reverses the hybrid encryption process: it uses your private key to decrypt the session key embedded in the PGP message, then uses that session key (AES-256) to decrypt the actual message content. If the message was signed, GPG also verifies the signature against the sender's public key.
How do I decrypt a file encrypted by someone else?
The file must have been encrypted specifically to your public key. If someone encrypted it to a different key or to themselves only, you cannot decrypt it — that is the point of asymmetric encryption. Ask the sender to re-encrypt to your public key. Export your public key with `gpg --armor --export you@email.com` and share it with senders.
What is an armored PGP message?
An armored PGP message is Base64-encoded binary PGP data wrapped in ASCII headers: `-----BEGIN PGP MESSAGE-----` and `-----END PGP MESSAGE-----`. Armoring makes the binary data safe for email, text files, and web forms. Binary `.gpg` files contain the same data without the encoding overhead and are about 25% smaller.
All articles · theproductguy.in