Pcornel
Security · Asymmetric Cryptography

RSA

Cheat sheet · https://pcornel.dk/topic.php?topic=4697

Back to the Topic

Answer

RSA is the classic public-key algorithm based on factoring large numbers, used for signatures and key transport. Use at least 2048-bit keys, preferably 3072, with OAEP or PSS padding.

Remember

  • Use at least 2048 bits; 3072 recommended.
  • Use OAEP for encryption and PSS for signatures.
  • RSA key exchange has no forward secrecy.

First checks

  • openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:3072 -out rsa.pem — generate
  • openssl rsa -in rsa.pem -noout -text | head -1 — key size
  • Padding: OAEP (encryption), PSS (signatures) — safe padding

Verify in this order

key pair → OAEP encrypt / PSS sign

Where it usually breaks

First mismatch in key/secret generation → storage/rotation → trust/certificate validation → protocol negotiation → cryptographic operation → peer/application verification; preserve identity/policy/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=4697

Confirmation

Confirm action

Continue?