liveBook · Manning

Hybrid encryption

As explained in Software Security for Developers

Hybrid encryption is a scheme that uses public-key cryptography to protect a symmetric encryption key and symmetric cryptography to protect the data.

Hybrid encryption combines fast symmetric encryption with public-key encryption: AES protects the content, while RSA protects the AES key. This avoids using RSA for large data, where its CPU-intensive mathematics is slow. section 6.3.2 section 6.5

A sender and recipient perform these steps:

  • Generate a random AES content encryption key (CEK). section 6.3.2
  • Encrypt the content with AES using the CEK. section 6.3.2
  • Wrap the CEK by encrypting it with the recipient’s RSA public key. section 6.3.2 section 6.5
  • Send the encrypted content and encrypted CEK; the recipient uses the RSA private key to unwrap the CEK, then decrypts the content with AES. section 6.3.2

Choosing the algorithms

Use AES for bulk data, such as AES-GCM with a 256-bit key, and RSA-OAEP for wrapping the CEK. Use RSA keys of at least 2,048 bits; avoid the older RSAES-PKCS1-v1_5 padding. section 6.3.2 section 6.5

Figure 6.5 Hybrid encryption uses a high-performance symmetric algorithm such as AES to encrypt content. Then the AES CEK is encrypted with the recipient’s RSA public key, allowing the recipient to use their private key to first the CEK and then decrypt the content.
figure

The diagram traces AES content encryption, RSA CEK wrapping, transmission of both encrypted values, and the recipient’s reverse process. section 6.3.2

How Software Security for Developers covers it

How deep it goes
Explains the sender and recipient steps, algorithm choices, key wrapping, and recommended RSA padding and key sizes.
Examples
Uses AES-GCM with a 256-bit key, RSA-OAEP, an AES CEK, and encrypted content-plus-key transmission.
What it assumes
Assumes familiarity with AES encryption and RSA public–private key pairs while defining CEKs and key wrapping.
What you can do after
Apply hybrid encryption by generating an AES CEK, encrypting content, wrapping the CEK with RSA-OAEP, and reversing those steps.
How it connects
Connects AES, RSA, key wrapping, RSA-OAEP, TLS, IPsec, JWE, and SSH.

Also explained in

Compare how 2 books explain hybrid encryption →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Software Security for Developers. The section links point to the parts of the book it draws on.