In cryptography, a key encapsulation mechanism (KEM) is a public-key cryptosystem that allows a sender to generate a short secret key and transmit it to a receiver confidentially, in spite of eavesdropping and intercepting adversaries. Modern standards for public-key encryption of arbitrary messages are usually based on KEMs. A KEM allows a sender who knows a public key to simultaneously generate a short random secret key and an encapsulation or ciphertext of the secret key by the KEM's encapsulation algorithm. The receiver who knows the private key corresponding to the public key can recover the same random secret key from the encapsulation by the KEM's decapsulation algorithm. The security goal of a KEM is to prevent anyone who does not know the private key from recovering any information about the encapsulated secret keys, even after eavesdropping or submitting other encapsulations to the receiver to study how the receiver reacts.
Difference from public-key encryption
The difference between a public-key encryption scheme and a KEM is that a public-key encryption scheme allows a sender to choose an arbitrary message from some space of possible messages, while a KEM chooses a short secret key at random for the sender. The sender may take the random secret key produced by a KEM and use it as a symmetric key for an authenticated cipher whose ciphertext is sent alongside the encapsulation to the receiver. This serves to compose a public-key encryption scheme out of a KEM and a symmetric-key authenticated cipher in a hybrid cryptosystem. Most public-key encryption schemes such as RSAES-PKCS1-v1_5, RSAES-OAEP, and Elgamal encryption are limited to small messages and are almost always used to encrypt a short random secret key in a hybrid cryptosystem anyway. And although a public-key encryption scheme can conversely be converted to a KEM by choosing a random secret key and encrypting it as a message, it is easier to design and analyze a secure KEM than to design a secure public-key encryption scheme as a basis. So most modern public-key encryption schemes are based on KEMs rather than the other way around.
Definition
Syntax A KEM consists of three algorithms:
Key generation, (𝑝𝑘,𝑠𝑘):=Gen(), takes no inputs and returns a pair of a public key 𝑝𝑘 and a private key 𝑠𝑘. Encapsulation, (k,c):=Encap(𝑝𝑘), takes a public key 𝑝𝑘, randomly chooses a secret key k, and returns k along with its encapsulation c. Decapsulation, k′:=Decap(𝑠𝑘,c′), takes a private key 𝑠𝑘 and an encapsulation c′, and either returns an encapsulated secret key k′ or fails, sometimes denoted by returning ⊥ (called "bottom"). In the asymptotic setting of theoretical cryptography, the algorithms are all probabilistic polynomial-time in a security parameter λ, and the length of the secret key k is a function of the security parameter λ. In practical cryptography, the secret key k is usually of a fixed length for each algorithm. For example, ML-KEM always uses 256-bit secret keys, while the algorithms in RFC 9180 vary between 256-, 384-, and 512-bit secret keys; secret keys of arbitrary length can be derived from k by a key derivation function.
Explicit vs. implicit rejection Decapsulation can fail because its input c′ is not an encapsulation c returned by Encap, but has been tampered with or maliciously crafted. KEMs which report failure by a distinguished symbol ⊥ (implemented in practice by returning an error code or raising an exception) are said to use explicit rejection. A KEM may instead return a random secret key in this event, or a secret key derived pseudorandomly from c′ under the key sk; this is called implicit rejection.
Correctness A KEM is correct if, for any key pair (𝑝𝑘,𝑠𝑘) generated by Gen, decapsulating an encapsulation c returned by (k,c):=Encap(𝑝𝑘) with high probability yields the same key k, that is, Decap(𝑠𝑘,c)=k.
Security: IND-CCA Security of a KEM is quantified by its indistinguishability against adaptive chosen-ciphertext attack, IND-CCA, which is loosely how much better an adversary can do than a coin toss to tell whether, given a random key and an encapsulation, the key is encapsulated by that encapsulation or is an independent random key. Specifically, in the IND-CCA game:
The key generation algorithm is run to generate (𝑝𝑘,𝑠𝑘):=Gen(). 𝑝𝑘 is revealed to the adversary. The adversary can query Decap(𝑠𝑘,c′) for arbitrary encapsulations c′ of the adversary's choice. The encapsulation algorithm is run to randomly generate a secret key and encapsulation (k0,c):=Encap(𝑝𝑘), and another secret key k1 is generated independently at random. A fair coin is tossed, giving an outcome b∈{0,1}. The pair (kb,c) is revealed to the adversary. The adversary can again query Decap(𝑠𝑘,c′) for arbitrary encapsulations c′ of the adversary's choice, except for c. The adversary returns a guess b′∈{0,1}, and wins the game if b=b′. The IND-CCA advantage of the adversary is |Pr[b′=b]−1/2|, that is, the probability beyond a fair coin toss at correctly distinguishing an encapsulated key from an independently randomly chosen key.
Applications
Public-key encryption A key encapsulation mechanism can be used together with an authenticated symmetric cipher to construct a public-key encryption scheme for arbitrary messages. The security requirement for the symmetric cipher, called a data encapsulation mechanism or DEM, is indistinguishability against chosen-ciphertext attack for a single message encrypted by the sender. Given a secure KEM with algorithms Gen/Encap/Decap, and a secure DEM Ek(m), the following hybrid public-key encryption scheme is also secure against adaptive chosen-ciphertext attack in the public-key setting:
… excerpt ends here. Continue reading the full article.


