RSA Encrypt and Decrypt
Encrypt a short message with an RSA public key and decrypt it with the private key using RSA-OAEP and SHA-256, or generate a 2048-bit key pair to try it.
Free · No sign-up · Your inputs stay in your browser
Input
Encrypt and decrypt with RSA-OAEP
Output
Result
0 characters
RSA encrypts only a few hundred bytes, so real systems encrypt the data with a random AES key and RSA-encrypt that key (hybrid encryption, which is what age, PGP and TLS do). OAEP padding with SHA-256 is the safe choice; the older PKCS#1 v1.5 encryption padding is open to padding-oracle attacks. Compatible with openssl pkeyutl -encrypt -pkeyopt rsa_padding_mode:oaep -pkeyopt rsa_oaep_md:sha256.
Runs in this browser. Nothing you paste is sent to a server.
About this tool
Method, assumptions, practical next steps, and limits.
RSA encrypts keys, not data
A 2048-bit RSA key with OAEP and SHA-256 encrypts at most 190 bytes. Real systems generate a random symmetric key, encrypt the data with AES, and encrypt only that key with RSA: hybrid encryption, which TLS, PGP and age all use. RFC 8017 defines OAEP.
Padding matters
The older PKCS#1 v1.5 encryption padding is vulnerable to padding-oracle attacks (Bleichenbacher's), so new code should use OAEP. Signing is a separate operation with its own padding schemes.