← Back to section · Foundations of Cryptography
RSA and Hybrid Encryption: Public Keys Move Keys, Data Belongs to Symmetric Ciphers
Real systems never encrypt data with RSA directly: it only wraps a random symmetric key, while bulk data, streaming and integrity all belong to the symmetric layer. The two-layer structure, the KEM/DEM decomposition, and RSA's narrow role as key courier.
A widespread misconception says that files, emails and databases are “encrypted with RSA”. In real systems RSA never touches the data itself. Its role in the encryption architecture is restrained and specific: carry one short random key safely from one party to another. The actual locking of data is always done by symmetric ciphers. This arrangement is called hybrid encryption, and understanding it is the key to understanding every modern public-key application.
Why RSA cannot encrypt data directly
Start with length. An RSA input must be smaller than the modulus , minus the structural space the padding consumes: a 2048-bit modulus is 256 bytes, and with OAEP padding (using SHA-256) the message that fits is only about 190 bytes. An email, a photo, a video — none of them fit in that capacity. In principle one could chop data into 190-byte blocks and encrypt each independently, but that is both slow and insecure: independently encrypted blocks leak the data’s block-level structure (identical blocks produce recognisable patterns) and provide no guarantee of ordering or integrity — an attacker can delete, reorder or duplicate blocks.
Next, speed. RSA’s core operation is modular exponentiation on two-thousand-bit numbers, good for a limited number of operations per second in software; symmetric algorithms such as AES enjoy hardware acceleration and process gigabytes per second. The gap is orders of magnitude. Asking RSA to move data is asking a safe’s lock cylinder to bear the weight of the building — a role mismatch.
Finally, function. Protecting data requires more than confidentiality: it needs integrity and authenticity — has the received data been altered, did it come from the claimed sender? RSA encryption alone provides no integrity (as the earlier article noted, successful decryption does not imply a trustworthy message), while the symmetric layer’s AEAD (authenticated encryption with associated data) delivers confidentiality and integrity together.
The two layers of hybrid encryption
The standard script runs as follows. The sender generates a one-time random symmetric key (say 256 bits) and uses it with an AEAD algorithm (AES-GCM or ChaCha20-Poly1305) to encrypt data of arbitrary length, producing ciphertext plus an authentication tag. The sender then encrypts that symmetric key under the recipient’s RSA public key with OAEP padding, producing a small “wrapped key” block, and sends both blocks together. The recipient first unwraps the key block with the private key, then uses the recovered symmetric key to decrypt the data and verify the tag.
The benefits compound layer by layer. The symmetric key is a high-entropy random value — exactly the input RSA handles best: short, high-entropy, structureless, so the earlier attacks on guessing, integer roots and related messages all lose their targets. The data layer gains every advantage of symmetric cryptography: arbitrary length, streaming, integrity protection. Key lifetimes also separate: the symmetric key is fresh per message, giving natural session-level isolation, while the long-lived RSA key performs only infrequent wrapping operations — fewer private-key operations, smaller side-channel surface.
What the hybrid structure looks like inside real protocols
This division is no theoretical ornament; nearly every protocol that has used public-key encryption is built on it. PGP and S/MIME encrypt mail by generating a random “session key” for the body, with RSA encrypting only that session key and travelling with the message; CMS’s EnvelopedData structure separates “encapsulation of the content-encryption key” and “content ciphertext” into two explicit fields. The RSA suites of TLS 1.2 were also a form of the hybrid structure: the pre-master secret was key material carried by RSA — except that it was coupled to the key derivation function and lacked forward secrecy (see this column’s TLS article for its retirement), which shows the hybrid structure is necessary but not sufficient; the carrying method itself must still meet modern requirements. A non-hybrid counterexample is equally instructive: some home-grown systems chopped long data into blocks and RSA-encrypted each block, losing the symmetric layer’s speed, integrity and anti-reordering protection all at once, and leaking data patterns through aligned block boundaries. Whenever a design “encrypts data directly with a public key” — RSA or any later algorithm — the first reaction should be: this step is on the wrong layer.
KEM/DEM: the division written as an interface
Cryptography abstracts this structure into a pair of interfaces: a KEM (key encapsulation mechanism) generates and encapsulates a random key, outputting the key and an encapsulation ciphertext; a DEM (data encapsulation mechanism) encrypts data under that key. In modern terms RSA-OAEP is a way of implementing a KEM (strictly, it can be adapted into a standard KEM), and the internals of TLS, PGP, S/MIME and CMS can all be read along this seam.
The value of the abstraction is cashed in at migration time. In the post-quantum era the encapsulation role passes to ML-KEM — an algorithm defined natively to the KEM interface: its public key encapsulates a shared secret together with a ciphertext, slotting exactly into the place RSA occupied in the hybrid structure. The data layer (AES-GCM and the like) needs only doubled key lengths under the quantum threat, since Grover’s algorithm weakens it only by a square-root factor; its structure does not change at all. The seam drawn decades ago for hybrid encryption turns out to be the cheapest cutting line for post-quantum migration: replace the encapsulation layer, keep the data layer.
Boundaries: division of labour is not absolution
Finally, the hybrid structure solves role allocation, not padding or implementation hygiene. If the encapsulation layer misuses v1.5 padding, the Bleichenbacher oracle stands as before. If the symmetric layer mismanages nonces — AES-GCM reusing a nonce under one key, for instance — confidentiality and integrity collapse together. If the random generator produces predictable “random” symmetric keys, the whole edifice fails at its foundation. Division of labour lets each layer use that layer’s most mature tools, but each layer’s discipline still has to be kept separately. RSA’s role in hybrid encryption is small, yet it is the trust anchor of the entire chain: what it carries is not data, but the seed from which all the other security grows.
Tags: RSAhybrid encryptionKEM