Skip to content
ecdsa.com

RSA-OAEP

RSA encryption with Optimal Asymmetric Encryption Padding (RFC 8017 §7.1), used in JWE as RSA-OAEP (SHA-1) and RSA-OAEP-256 (SHA-256) to wrap content keys, replacing the attackable PKCS #1 v1.5 encryption.
Also written asRSAES-OAEPRSA-OAEP-256OAEP

OAEP hashes and masks the message with a random seed before exponentiation, giving security against chosen-ciphertext attacks in the random-oracle model; a 2048-bit key with SHA-256 can encrypt at most 190 bytes, enough for any symmetric key. In JWE, RSA-OAEP uses SHA-1 for both hash and MGF1, which is still considered secure for OAEP, and RSA-OAEP-256 uses SHA-256; RSA1_5 (PKCS #1 v1.5) should not be used because of padding-oracle attacks.

Elsewhere you meet it in CMS key transport, WebCrypto (RSA-OAEP), cloud KMS envelope encryption and TPMs. Libraries default to different hashes (OpenSSL and many APIs to SHA-1, WebCrypto requires an explicit hash), so mismatched OAEP parameters are a common cause of decryption failures. Implementations must not reveal why decryption failed, or Manger's attack applies.

Standards and references

All terms