21 April 2025
RSA for Encryption and Signature
RSA
RSA is a cryptographic algorithm mainly used for two purposes.
- Encryption/Decryption
- Digital Signatures
Historically, HTTPS (TLS) used RSA for both key exchange and authentication. When you visit a website,
server sends a digital certificate (often RSA-based) to prove its identity. Today, RSA is still used,
but sometimes replaced by newer methods like ECDHE (Elliptic Curve Diffie-Hellman Ephemeral) for better
security
Padding Schemes in RSA
Plain RSA encryption without padding is insecure. Padding adds randomness and structure to the message
before encryption. It prevents attacks like replay attacks, chosen-plaintext attacks, and makes RSA
safer. Padding in RSA = add randomness and structure to protect security
Padding is like adding a secret envelope around your letter before you seal and mail it — Without it,
someone might guess what's inside just by the shape!
-
PKCS#1 v1.5 for Encryption- Traditional padding for encryption/signature. Deprecated (insecure if
not careful).
-
RSAES-OAEP for Encryption - Adds randomness. Much stronger security. Standard for RSA encryption now
-
PSS (Probabilistic Signature Scheme) - Padding for digital signatures. Very secure. Adds randomness.
Standard for RSA signatures today
- No Padding (NOT recommended) - Raw RSA. Very dangerous — totally insecure
RSA Current Situation
- RSA Algorithm (basic idea) - Still in use
- Small RSA key sizes (less than 2048 bits) - Deprecated. Minimum 2048 bits recommended
- RSA-2048 / RSA-3072- Still commonly used
- RSA-4096 - Very strong, but slower
- Using RSA correctly (with OAEP or PSS and strong key sizes) is still safe and standard
- Old RSA methods (like PKCS#1 v1.5 without careful handling) are deprecated