PKE family

RSA-OAEP

RSA encryption with Optimal Asymmetric Encryption Padding (PKCS #1 v2)

legacy 3 variants PKCS #1 v2.2 (RFC 8017)

Overview

RSA-OAEP is the padding scheme that makes RSA encryption secure against chosen-ciphertext attacks, specified in PKCS #1 version 2 (RFC 8017). It remains acceptable for interoperability but is classical and much larger and slower than modern alternatives.

Raw RSA encryption is deterministic and malleable. OAEP fixes this by encoding the message with a random seed through a two-round Feistel network built from a hash function and a mask generation function (MGF1), producing a padded block that is then raised to the public exponent modulo n. The construction is IND-CCA2 secure in the random oracle model, assuming the RSA problem is hard.

The main practical risk is implementation leakage. Manger's attack showed that if a decryptor reveals whether the first byte of the decoded block was zero, through error messages or timing, an attacker can decrypt ciphertexts. Decoding must therefore be constant time and must return a single uniform error. Three key sizes are present: 2048, 3072 and 4096-bit moduli. A 2048-bit key offers roughly 112-bit classical security and 3072-bit roughly 128-bit.

History

1977–2016
  1. RSA published by Rivest, Shamir and Adleman

  2. PKCS #1 v1.5 published

  3. RSA-OAEP published

  4. Bleichenbacher's padding-oracle attack on PKCS #1 v1.5

  5. PKCS #1 v2.2 published as RFC 8017

How it works

  1. KeyGen picks two large primes p and q, sets n = pq, and chooses e and d with ed = 1 mod lcm(p-1, q-1).
  2. Encrypt pads the message with a hashed label and random seed via MGF1 masking, then computes c = m^e mod n.
  3. Decrypt computes m = c^d mod n and reverses the OAEP encoding.
  4. Any decoding failure is reported identically, in constant time.

Security notes

Broken by a large quantum computer, and keys and ciphertexts are large compared with elliptic-curve or lattice schemes. Implementations that leak decoding errors or timing are vulnerable to Manger-style attacks. Prefer HPKE or a KEM for new designs.

Typical uses

Interoperability with existing PKCS #11, JOSE and CMS systemsKey wrapping in legacy enterprise and HSM workflowsEncrypting small secrets to an RSA certificate

Variants in NextSSL

3
AlgorithmTierSizes (bytes)StandardsAPI
RSA-OAEP-2048
rsa-oaep-2048
legacy out 0–190 · pk 264–288 · sk 768–1344 · ct 256 · ctx 0–64 RFC 8017 root
RSA-OAEP-3072
rsa-oaep-3072
legacy out 0–318 · pk 392–416 · sk 1152–1984 · ct 384 · ctx 0–64 RFC 8017 root
RSA-OAEP-4096
rsa-oaep-4096
legacy out 0–446 · pk 520–544 · sk 1536–2624 · ct 512 · ctx 0–64 RFC 8017 root

Frequently asked questions

Which RSA-OAEP variants does NextSSL include?

NextSSL registers 3 RSA-OAEP variants: rsa-oaep-2048, rsa-oaep-3072, rsa-oaep-4096.