PGP Encrypt & Decrypt Online | OpenPGP GPG Key Generator Browser
Encryption How It Works
What Is OpenPGP Encryption?
OpenPGP (Pretty Good Privacy) is a hybrid encryption standard defined in RFC 4880. It combines the speed of symmetric encryption (like AES or ChaCha20) with the key distribution advantages of public-key cryptography (like RSA or ECC). A message is encrypted with a randomly generated session key, which is then encrypted with the recipient's public key. Only the holder of the corresponding private key can decrypt the session key and, in turn, the message.
This tool implements OpenPGP encryption, decryption, signing, and verification using openpgp.js. It is fully compatible with GnuPG (GPG) and other PGP implementations. Two encryption modes are available: public key (asymmetric, for sending to specific recipients) and password (symmetric, for shared-secret scenarios). All cryptographic operations run locally in your browser — no data is sent to any server.
When to Use PGP
- Email encryption — Secure email communication using PGP/MIME or inline PGP
- File signing — Prove the authenticity and integrity of software releases or documents
- Messaging — End-to-end encrypted messages via any channel (chat, forums, etc.)
- Key distribution — Share encrypted data with specific recipients without pre-sharing secrets
- Cleartext signatures — Sign announcements or emails while keeping the message readable
- When NOT to use — For bulk data encryption between your own systems, use AES-256-GCM directly
Key Algorithm Comparison
| Algorithm | Key Size | Signature Size | Generation Speed | Best for |
|---|---|---|---|---|
| ECC (Curve25519) | 256-bit | ~64 bytes | Very fast | Modern use, email, messaging |
| RSA | 2048–4096-bit | 256–512 bytes | Slower | Legacy compatibility, enterprise |
Standards Compliance
- RFC 4880 — OpenPGP Message Format specification
- RFC 4880bis — Updated OpenPGP specification (in progress)
- RFC 6637 — ECC in OpenPGP (Curve25519, NIST curves)
- GnuPG — Fully compatible with GPG command-line tool
- openpgp.js — IETF OpenPGP Working Group reference implementation
Last updated:
Code Examples
Encrypt and sign messages with OpenPGP in multiple languages:
JavaScript — openpgp.js (Browser)
// PGP encrypt with public key
import * as openpgp from 'openpgp';
const publicKey = await openpgp.readKey({ armoredKey: pubKeyArmored });
const message = await openpgp.createMessage({ text: 'secret message' });
const encrypted = await openpgp.encrypt({
message,
encryptionKeys: publicKey,
});
console.log(encrypted); // ASCII-armored PGP block Python — GnuPG (python-gnupg)
import gnupg
gpg = gnupg.GPG()
with open('recipient.pub.asc') as f:
gpg.import_keys(f.read())
encrypted = gpg.encrypt('secret message', '[email protected]')
print(str(encrypted)) # ASCII-armored PGP output Go — gopenpgp
import "github.com/ProtonMail/gopenpgp/v2/crypto"
publicKey, _ := crypto.NewKeyFromArmored(recipientPubKey)
keyRing, _ := crypto.NewKeyRing(publicKey)
message := crypto.NewPlainMessageFromString("secret message")
encrypted, _ := keyRing.Encrypt(message, nil)
fmt.Println(encrypted.GetArmored()) Rust — pgp crate
use pgp::composed::{SignedPublicKey, Message};
use pgp::types::SecretKeyTrait;
// Parse armored public key
let pubkey = SignedPublicKey::from_string(armored_key)?;
// Create and encrypt message
let message = Message::new_literal("hello", "secret message");
let encrypted = message.encrypt_to_keys(&rng, &[&pubkey.primary_key])?; Node.js — openpgp (CommonJS)
const openpgp = require('openpgp');
async function encryptMessage(pubKeyArmored, text) {
const publicKey = await openpgp.readKey({ armoredKey: pubKeyArmored });
const message = await openpgp.createMessage({ text });
return openpgp.encrypt({ message, encryptionKeys: publicKey });
}
encryptMessage(pubKey, 'secret message')
.then(encrypted => console.log(encrypted)); Common Pitfalls
Security Notes
Disclaimer
This tool is provided for educational and development purposes. PGP security depends on proper key management, which is the user's responsibility. For production systems, follow GnuPG best practices and RFC 4880 specifications. Always verify key fingerprints through trusted channels.
Further Reading
- RFC 4880 — OpenPGP Message Format
- RFC 6637 — ECC in OpenPGP
- GnuPG Documentation
- openpgp.js — JavaScript OpenPGP Implementation
Related Concepts
- RSA Key Generator — Generate RSA key pairs in PEM format
- Ed25519 Sign/Verify — Modern digital signatures using Ed25519
- Digital Signature Verify — Verify signatures with various algorithms
Related Tools
Need symmetric encryption instead? Try AES Encrypt/Decrypt for fast, key-based encryption. To generate RSA key pairs for use with PGP, the RSA Key Generator creates keys in PEM format. For interactive key exchange demonstrations, try the ECDH Key Exchange tool.
Frequently Asked Questions
Can I use this with GnuPG (GPG) keys?
Yes. This tool uses the OpenPGP standard (RFC 4880), the same protocol implemented by GnuPG. Export your GPG key with "gpg --armor --export [email protected]" and paste it here. Messages encrypted in this tool can be decrypted with GPG, and vice versa.
Which algorithm should I choose — ECC or RSA?
ECC (Curve25519) is recommended for most users: it produces shorter keys and signatures, is faster to generate, and offers equivalent security to RSA with much smaller key sizes. RSA (2048–4096 bits) is the traditional choice and has broader legacy compatibility. If you are unsure, choose ECC.
What is the difference between public key and password encryption?
Public key encryption uses the recipient's public key — only their private key can decrypt. It is ideal for sending messages to specific people without sharing secrets beforehand. Password encryption uses a shared password that both sender and recipient must know — simpler but requires a secure channel to share the password. Choose public key for most use cases.
What is the Key Generator for?
The built-in Key Generator creates a fresh PGP key pair (ECC Curve25519 or RSA) directly in your browser. Generated keys can be downloaded as .asc files or used immediately in the Encrypt, Decrypt, and Sign modes via the "Use this key pair" button. This is useful for testing, learning, or generating keys for non-critical use cases.
Can I sign a message without encrypting it?
Yes. The Sign mode supports two formats: Cleartext Signature (the message stays readable with a signature block appended — ideal for emails and announcements) and Inline Signature (the message is wrapped inside an opaque armored block — suitable when the content should not be visible without verification). The recipient uses the Verify mode with your public key to confirm authenticity.
Privacy: This tool runs entirely in your browser — nothing is uploaded or stored. · Disclaimer: For educational purposes only. Not professional security advice.
More in Encryption
AES Encrypt/Decrypt
Encrypt and decrypt with AES-128/192/256 online. GCM, CTR, and OpenSSL-compatible CBC modes. Passphrase or raw key, custom IV.
ChaCha20 / Salsa20 Encrypt/Decrypt
Encrypt and decrypt with ChaCha20, XChaCha20, ChaCha20-Poly1305 (AEAD), or Salsa20 online. Passphrase mode with PBKDF2 key derivation.
RSA Encrypt / Decrypt
Encrypt and decrypt with RSA-OAEP online via Web Crypto API. Built-in key generator, PKCS#8/PKCS#1 conversion, SHA-256/384/512.
DES Encrypt/Decrypt
Encrypt and decrypt with DES or 3DES (Triple DES) online. CBC/ECB/CFB/OFB modes, PKCS7/NoPadding, OpenSSL compatible.
XOR Encrypt/Decrypt
Encrypt and decrypt with XOR cipher online. Text/Hex/Base64 formats, visual XOR table, brute-force key breaking, auto-solve.
JWE Encrypt / Decrypt
Encrypt and decrypt JWE (JSON Web Encryption) tokens online. RSA-OAEP, AES key wrap, PBES2 password-based key management, A128GCM/A256GCM.
Blowfish Encrypt/Decrypt
Encrypt and decrypt with Blowfish online. 5 cipher modes, 5 paddings, GBK/UTF-16 support, OpenSSL passphrase compatible.