OpenSSL & Cert8 min read

RSA Encryption Explained: Public Keys, Private Keys, and How It Works

A clear explanation of RSA asymmetric encryption — how public and private keys work, key sizes (1024 vs 2048 vs 4096-bit), digital signatures, and practical use cases.

What is RSA?

RSA (Rivest–Shamir–Adleman) is the most widely used asymmetric encryption algorithm. It was published in 1977 and remains a cornerstone of modern internet security. RSA is used in SSL/TLS certificates, SSH keys, code signing, email encryption (S/MIME, PGP), and many other security applications.

How Asymmetric Encryption Works

RSA uses a key pair — a public key and a private key. These keys are mathematically related but it is computationally infeasible to derive the private key from the public key.

Use CaseEncrypt/Sign withDecrypt/Verify with
Send encrypted messageRecipient's public keyRecipient's private key
Digital signatureSender's private keySender's public key
SSL/TLS handshakeServer's public keyServer's private key

Key Sizes

Key SizeSecurity LevelStatusUse Case
1024-bitWeak❌ DeprecatedLegacy only — do not use
2048-bitGood✅ StandardCurrent minimum for SSL/TLS and SSH
4096-bitVery strong✅ High securityRoot CAs, long-lived certificates

RSA vs ECDSA

Elliptic Curve Digital Signature Algorithm (ECDSA) is a modern alternative to RSA that provides the same security with much shorter keys:

RSAECDSA
Security equivalent2048-bit256-bit (P-256)
Key sizeLargeSmall
PerformanceSlowerFaster
CompatibilityUniversalVery good (modern systems)
Used inMost SSL certsCloudflare, Google, Bitcoin

✓ For new applications: prefer ECDSA P-256 for its better performance. Use RSA 2048-bit when maximum compatibility with older systems is required.

TRY THE FREE TOOL

RSA Key Generator

Generate RSA key pairs instantly in your browser

Open Tool →
← Back to all articles