Last updated
What is RSA Encryption?
RSA (Rivest-Shamir-Adleman) is a public-key cryptosystem widely used for secure data transmission. It uses a pair of keys: a public key for encryption and a private key for decryption. The public key can be shared freely, while the private key must be kept secret. RSA is fundamental to modern internet security, used in SSL/TLS, SSH, email encryption, and digital signatures.
RSA key pairs consist of two mathematically related keys. Data encrypted with the public key can only be decrypted with the corresponding private key, and vice versa. This asymmetric encryption enables secure communication without sharing secret keys beforehand.
RSA Key Components
- Private Key: Secret key used for decryption and signing
- Public Key: Shared key used for encryption and verification
- Key Size: Length in bits (2048 or 4096 recommended)
- PEM Format: Base64 encoded with headers/footers
- Modulus: Large number that's product of two primes
- Exponent: Public exponent (usually 65537)
-----BEGIN RSA PRIVATE KEY----- MIIEpAIBAAKCAQEA... (Base64 encoded data) -----END RSA PRIVATE KEY----- -----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA... -----END PUBLIC KEY-----
How to Use the RSA Key Generator
Step 1: Choose Key Size
Select 2048-bit for standard security (recommended for most uses) or 4096-bit for enhanced security. Larger keys are more secure but slower to generate and use. 2048-bit keys are currently considered secure for most applications.
Step 2: Generate Keys
Click "Generate RSA Keys" to create a new key pair. Generation happens entirely in your browser using cryptographically secure random number generation. No keys are transmitted to any server.
Step 3: Save Keys Securely
Download both keys immediately. Store the private key in a secure location with restricted access. The public key can be shared freely. Never commit private keys to version control or share them via insecure channels.
Step 4: Use Your Keys
Use the public key for encryption or signature verification. Use the private key for decryption or signing. Common uses include SSH authentication, SSL/TLS certificates, and encrypted communication.
Common Use Cases
1. SSH Authentication
Use RSA keys for passwordless SSH login to servers. Add your public key to ~/.ssh/authorized_keys on the server. Use the private key to authenticate without entering passwords.
2. SSL/TLS Certificates
Generate RSA keys for SSL/TLS certificates. The private key stays on your server, while the public key is included in the certificate signed by a Certificate Authority.
3. Code Signing
Sign software releases with your private key. Users verify signatures with your public key, ensuring the software hasn't been tampered with and comes from you.
4. Email Encryption (PGP/GPG)
Use RSA keys for email encryption with PGP or GPG. Share your public key so others can send you encrypted emails that only you can decrypt with your private key.
5. API Authentication
Some APIs use RSA keys for authentication. Generate a key pair, register the public key with the API provider, and use the private key to sign requests.
RSA Key Examples
Example 1: SSH Key Setup
# Add public key to server cat id_rsa.pub >> ~/.ssh/authorized_keys # Set correct permissions chmod 600 ~/.ssh/authorized_keys # Connect using private key ssh -i id_rsa user@server.com
Example 2: Encrypt File with Public Key
# Encrypt file openssl rsautl -encrypt -pubin -inkey public.pem \ -in file.txt -out file.enc # Decrypt file with private key openssl rsautl -decrypt -inkey private.pem \ -in file.enc -out file.txt
Example 3: Sign Data
# Sign data with private key openssl dgst -sha256 -sign private.pem \ -out signature.bin data.txt # Verify signature with public key openssl dgst -sha256 -verify public.pem \ -signature signature.bin data.txt
Example 4: Extract Public Key from Private
# Extract public key from private key openssl rsa -in private.pem -pubout -out public.pem # View key details openssl rsa -in private.pem -text -noout
Example 5: Convert Key Formats
# Convert to PKCS#8 format openssl pkcs8 -topk8 -inform PEM -outform PEM \ -in private.pem -out private_pkcs8.pem -nocrypt # Convert to SSH format ssh-keygen -f public.pem -i -m PKCS8
Frequently Asked Questions
Frequently Asked Questions
Yes, our Rsa Generator is completely free with no registration required. Use it unlimited times without any restrictions.
Yes, all processing happens locally in your browser. Your data never leaves your device and is not stored on our servers.
No installation needed. The tool works directly in your web browser on any device.
Simply click the generate button and the tool will create a secure, random output instantly. You can customize options if available.
Yes, use the available options to adjust the output format and parameters to match your needs.