
In
cryptography
Cryptography, or cryptology (from "hidden, secret"; and ''graphein'', "to write", or ''-logy, -logia'', "study", respectively), is the practice and study of techniques for secure communication in the presence of Adversary (cryptography), ...
, a key encapsulation mechanism (KEM) is a
public-key cryptosystem
Public-key cryptography, or asymmetric cryptography, is the field of cryptographic systems that use pairs of related keys. Each key pair consists of a public key and a corresponding private key. Key pairs are generated with cryptographic a ...
that allows a sender to generate a short secret key and transmit it to a receiver securely, in spite of
eavesdropping
Eavesdropping is the act of secretly or stealthily listening to the private conversation or communications of others without their consent in order to gather information.
Etymology
The verb ''eavesdrop'' is a back-formation from the noun ''eave ...
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
Hybrid may refer to:
Science
* Hybrid (biology), an offspring resulting from cross-breeding
** Hybrid grape, grape varieties produced by cross-breeding two ''Vitis'' species
** Hybridity, the property of a hybrid plant which is a union of two diff ...
.
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,
, takes no inputs and returns a pair of a public key
and a private key
.
# Encapsulation,
, takes a public key
, randomly chooses a secret key
, and returns
along with its encapsulation
.
# Decapsulation,
, takes a private key
and an encapsulation
, and either returns an encapsulated secret key
or fails, sometimes denoted by returning
(called ‘
bottom’).
Correctness
A KEM is correct if, for any key pair
generated by
, decapsulating an encapsulation
returned by
with high probability yields the same key
, that is,
.
Security: IND-CCA
Security of a KEM is quantified by its
indistinguishability against 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
.
#
is revealed to the adversary.
# The adversary can query
for arbitrary encapsulations
of the adversary's choice.
# The encapsulation algorithm is run to randomly generate a secret key and encapsulation
, and another secret key
is generated independently at random.
# A fair coin is tossed, giving an outcome
.
# The pair
is revealed to the adversary.
# The adversary can again query
for arbitrary encapsulations
of the adversary's choice, ''except'' for
.
# The adversary returns a guess
, and wins the game if
.
The IND-CCA advantage of the adversary is
, that is, the probability beyond a fair coin toss at correctly distinguishing an encapsulated key from an independently randomly chosen key.
Examples and motivation
RSA
Traditional
RSA encryption, with
-bit moduli and exponent
, is defined as follows:
* Key generation,
:
# Generate a
-bit semiprime
with
at random satisfying
, where
is the
Carmichael function.
# Compute
.
# Return
as the public key and
as the private key. (Many variations on key generation algorithms and private key formats are available.
)
* Encryption of
-bit message
to public key
, giving
:
# Encode the bit string
as an integer
with
.
# Return
.
* Decryption of ciphertext
with private key
, giving
:
# Compute
.
# Decode the integer
as a bit string
.
This naive approach is totally insecure.
For example, since it is nonrandomized, it cannot be secure against even
known-plaintext attack
The known-plaintext attack (KPA) is an attack model for cryptanalysis where the attacker has access to both the plaintext (called a crib) and its encrypted version (ciphertext). These can be used to reveal secret keys and code books. The term " ...
—an adversary can tell whether the sender is sending the message
ATTACK AT DAWN
versus the message
ATTACK AT DUSK
simply by encrypting those messages and comparing the ciphertext.
Even if
is always a random secret key, such as a 256-bit
AES key, when
is chosen to optimize efficiency as
, the message
can be computed from the ciphertext
simply by taking real number cube roots, and there are many other
attacks against plain RSA.
Various
randomized padding schemes have been devised in attempts—sometimes failed, like
RSAES-PKCS1-v1_5—to make it secure for arbitrary short messages
.
Since the message
is almost always a short secret key for a
symmetric-key authenticated cipher used to encrypt an arbitrary bit string message, a simpler approach called RSA-KEM is to choose an element of
at random and use that to ''derive'' a secret key using a
key derivation function
In cryptography, a key derivation function (KDF) is a cryptographic algorithm that derives one or more secret keys from a secret value such as a master key, a password, or a passphrase using a pseudorandom function (which typically uses a cr ...
, roughly as follows:
* Key generation: As above.
* Encapsulation for a public key
, giving
:
# Choose an integer
with
uniformly at random.
# Return
and
as its encapsulation.
* Decapsulation of
with private key
, giving
:
# Compute
.
# Return
.
This approach is simpler to implement, and provides a tighter reduction to the
RSA problem
In cryptography, the RSA problem summarizes the task of performing an RSA private-key operation given only the public key. The RSA algorithm raises a ''message'' to an '' exponent'', modulo a composite number ''N'' whose factors are not known. ...
, than padding schemes like
RSAES-OAEP.
Elgamal
Traditional
Elgamal encryption is defined over a multiplicative subgroup of the finite field
with generator
of order
as follows:
* Key generation,
:
# Choose
uniformly at random.
# Compute
.
# Return
as the private key and
as the public key.
* Encryption of a message
to public key
, giving
:
# Choose
uniformly at random.
# Compute:
# Return the ciphertext
.
* Decryption of a ciphertext
for a private key
, giving
:
# Fail and return
if
or if
, i.e., if
or
is not in the subgroup generated by
.
# Compute
.
# Return
.
This meets the syntax of a public-key encryption scheme, restricted to messages in the space
(which limits it to message of a few hundred bytes for typical values of
).
By validating ciphertexts in decryption, it avoids leaking bits of the private key
through maliciously chosen ciphertexts outside the group generated by
.
However, this fails to achieve
indistinguishability against chosen ciphertext attack.
For example, an adversary having a ciphertext
for an unknown message
can trivially decrypt it by querying the decryption oracle for the distinct ciphertext
, yielding the related plaintext
, from which
can be recovered by
.
Traditional Elgamal encryption can be adapted to the elliptic-curve setting, but it requires some way to reversibly encode messages as points on the curve, which is less trivial than encoding messages as integers mod
.
Since the message
is almost always a short secret key for a
symmetric-key authenticated cipher used to encrypt an arbitrary bit string message, a simpler approach is to ''derive'' the secret key from
and dispense with
and
altogether, as a KEM, using a
key derivation function
In cryptography, a key derivation function (KDF) is a cryptographic algorithm that derives one or more secret keys from a secret value such as a master key, a password, or a passphrase using a pseudorandom function (which typically uses a cr ...
:
* Key generation: As above.
* Encapsulation for a public key
, giving
:
# Choose
uniformly at random.
# Compute
.
# Return
and
as its encapsulation.
* Decapsulation of
with private key
, giving
:
# Fail and return
if
, i.e., if
is not in the subgroup generated by
.
# Compute
.
# Return
.
When combined with an authenticated cipher to encrypt arbitrary bit string messages, the combination is essentially the
Integrated Encryption Scheme.
Since this KEM only requires a one-way key derivation function to hash random elements of the group it is defined over,
in this case, and not a reversible encoding of messages, it is easy to extend to more compact and efficient elliptic curve groups for the same security, as in the
ECIES, Elliptic Curve Integrated Encryption Scheme.
See also
*
Key Wrap
*
Optimal Asymmetric Encryption Padding
*
Hybrid Cryptosystem
Hybrid may refer to:
Science
* Hybrid (biology), an offspring resulting from cross-breeding
** Hybrid grape, grape varieties produced by cross-breeding two ''Vitis'' species
** Hybridity, the property of a hybrid plant which is a union of two diff ...
References
{{DEFAULTSORT:Key encapsulation
Public-key encryption schemes
Key management