RSA Encryption & Decryption
Generate or paste PEM keys, then encrypt with the public key and decrypt with the private key—all locally in your browser.
RSA Decryption
Use a PKCS#8 private key to recover readable text.
- Paste ciphertext
- Add private key
- Decrypt
RSA Encryption
Use an SPKI public key to encrypt readable text.
RSA encryption and decryption, explained
A practical guide to RSA-OAEP, public and private keys, and safe use of the browser-based RSA utility.
RSA is an asymmetric cryptosystem. Instead of one shared secret, it uses a key pair: a public key that can be distributed and a private key that must remain confidential. A message encrypted with a recipient’s public key is decrypted with that recipient’s corresponding private key. This property makes RSA useful for exchanging small secrets and verifying ownership of private keys, but it is not usually the right choice for encrypting large files or long messages directly.
This tool uses RSA-OAEP with SHA-256 and PEM-formatted keys. Generate a key pair, keep the private key in a secure location, and copy the public key only to parties that need to encrypt for you. When decrypting, the private key must match the public key used for encryption. RSA-OAEP has a maximum message length that depends on the key size and hash algorithm, so a large text input may be rejected even when the keys are valid.
In production systems, RSA commonly protects a randomly generated symmetric session key, while AES-GCM encrypts the actual content. This hybrid approach is faster and avoids RSA message-size limits. A private key is highly sensitive: browser-local processing reduces accidental transmission by this page, but it does not protect a device that is already compromised. Do not paste long-lived production private keys into tools you do not control, and prefer a managed, reviewed cryptography implementation for deployed applications.
A careful workflow
- Use a public key to encrypt and the paired private key to decrypt.
- Keep PEM headers, line breaks, and the complete key material intact.
- Use RSA for short secrets; use authenticated symmetric encryption for the payload.
FAQ
Can I decrypt with a public key?
No. With RSA-OAEP, decryption requires the matching private key.
Why is my message too long?
RSA-OAEP can encrypt only a limited number of bytes. Encrypt a short session key instead, then use that key with a symmetric cipher.
Is an RSA key pair also for signatures?
RSA encryption and RSA signatures use related key material but different padding and operations. Use a dedicated signature implementation for signatures.
Further reading: NIST RSA key-establishment guidance