RSA-OAEP · SHA-256 · AES-256-GCM

RSA and hybrid

Generate a key pair: share the public key, keep the private key. Data encrypted with the public key can only be decrypted by the holder of the private key.

1 Key pair

2 Encrypt or decrypt

Operation
Source

Input

The key you generated above is filled in automatically; you can also paste someone else's public key.

You need the private key that belongs to the public key the package was encrypted with.

File

Output

The result will appear here. Nothing is sent to the server.
How it works
  1. RSA is a key pair: data encrypted with the public key can only be decrypted with the private key. Its security rests on how hard it is to factor the product of two large primes.
  2. RSA can only encrypt a few hundred bytes at a time and is slow. So every message gets a random AES-256 key, the data is encrypted with AES-GCM, and RSA-OAEP encrypts ("wraps") only that AES key. This is called hybrid encryption; HTTPS and PGP work the same way.
  3. OAEP is the padding scheme that adds randomness to RSA: the same key encrypting the same message twice gives different output, and the old "textbook RSA" attacks no longer work.
  4. The fingerprint is the SHA-256 hash of the public key. When you receive someone's public key, confirm the fingerprint with them another way (phone, in person) so you would notice if someone in between handed you their own key.
Byte layout of a package
CTH3 B v11 B Length2 B Wrapped AES key256–512 B IV12 B Ciphertextn B GCM tag16 B

The private key is downloaded as an unencrypted PEM. In real use, keep it somewhere safe (e.g. a password manager).