Key encapsulation vs public-key encryption: what a KEM actually does

A key encapsulation mechanism (KEM) produces a shared secret and an encapsulation of it, while public-key encryption protects a message directly; the sources show how the two are combined in HPKE, CMS and TLS.

On this page

KEM vs public-key encryption: which one your design needs

A key encapsulation mechanism (KEM) and public-key encryption solve different parts of the same problem. A KEM takes a recipient's public key and produces a fresh shared secret together with an encapsulation of it, which only the holder of the private key can recover. Public-key encryption takes a plaintext and encrypts it directly under the public key. In short, a KEM establishes a shared secret, while public-key encryption encrypts a message. Practitioners meet this distinction in protocol design, in PKI and cryptography reviews, and in procurement teams reading vendor documents that list ML-KEM and HPKE side by side.

The distinction shows up in the standards these readers consult. RFC 9180 defines the Hybrid Public Key Encryption (HPKE) scheme as built from a KEM, a KDF and an AEAD, and says the setup functions call Encap on the sender side and Decap on the recipient side before a key schedule derives the AEAD key used for the messages. RFC 9629 lets CMS carry a KEM-based recipient structure, where the originator encapsulates a fresh shared secret for each recipient and uses a KDF to derive a key that wraps the content-encryption key. FIPS 203 standardizes ML-KEM as a key-encapsulation mechanism with three parameter sets, ML-KEM-512, ML-KEM-768 and ML-KEM-1024. In TLS, hybrid named groups such as X25519MLKEM768 carry ML-KEM material in the key shares rather than encrypted application data.

For a design decision, start by asking what your system must do with the output. If you need a session key that both sides derive and then use with a symmetric cipher, a KEM is the natural primitive, and HPKE or a protocol such as TLS does the surrounding work. If you need to encrypt an arbitrary-length message to a recipient, you need a scheme that combines a KEM with a KDF and an AEAD, which is what HPKE provides. Confirm which HPKE KEM identifiers and CMS revisions your libraries support, and check the draft and RFC status of the version you plan to deploy, since draft-ietf-hpke-pq is still an Internet-Draft as of this writing.

KEM and public-key encryption side by side

This table compares the traditional wrap-a-key approach, HPKE, the CMS KEMRecipientInfo structure and ML-KEM across what each produces, where it is defined, its status and where it is supported. Read each row as a separate question, since a KEM is a key-establishment primitive that other constructions build on, not a complete message encryption scheme on its own. The main takeaway is that a KEM outputs a shared secret plus an encapsulation, and the message encryption is handled by a separate layer such as HPKE or CMS.

AttributeTraditional wrap-a-keyHPKE (RFC 9180)CMS KEMRecipientInfo (RFC 9629)ML-KEM (FIPS 203)
What it producesEncrypted symmetric key under the recipient's public keyEncapsulated key plus ciphertexts under the derived AEAD keyWrapped content-encryption key in encryptedKeyShared secret and an encapsulation of it
Defining document and dateVaries by scheme, not a single defining documentRFC 9180, February 2022RFC 9629, August 2024, updates RFC 5652FIPS 203, published 13 August 2024
StatusEstablished practice, no single standardInformational, from the IRTF CFRGStandards TrackFederal standard from NIST
Role in a messageCarries the symmetric key only, with data encrypted separatelyPublic key encryption built from a KEM, KDF and AEAD for arbitrary-length plaintextsRecipient structure that lets CMS use a KEM to protect the content keyKey-establishment mechanism only, used inside a higher-level scheme
Parameter sets or identifiersDepends on the chosen public-key algorithmKEM identifiers such as 0x0040 ML-KEM-512, 0x0041 ML-KEM-768 and 0x0042 ML-KEM-1024 in draft-ietf-hpke-pq-05Identified by id-ori-kemML-KEM-512, ML-KEM-768 and ML-KEM-1024, in increasing security strength
Fresh secret per recipientNot specified by the wrap approach itselfEncap generates a fresh shared secret each callRequired by RFC 9629 for each recipient, discarded after useEach encapsulation yields a fresh shared secret
Modes or variantsNot applicableBase, PSK, Auth and AuthPSK modesSingle KEM recipient structureThree parameter sets only
Where it is supportedWherever the chosen public-key scheme is supportedHPKE implementations and drafts for post-quantum and hybrid KEMsCMS implementations that adopt RFC 9629Any implementation of FIPS 203, confirm the version you run

What each approach is and where practitioners meet it

In the traditional pattern, a sender generates a random symmetric key, encrypts the message under that key, and then encrypts the symmetric key itself under the recipient's public key. The recipient uses their private key to recover the symmetric key and decrypts the message. Practitioners meet this pattern in long-established formats and tools that wrap a content-encryption key for one or more recipients, so the mental model of 'encrypt the key with the public key' is common across many systems. The approach is defined by the protocols and formats that use it, not by a single standard that describes the general idea.

  • Where the key is wrapped: The symmetric key is the value being protected, and the public-key operation is applied directly to it.
  • Recipient handling: Each recipient typically receives their own wrapped copy of the same symmetric key, so adding recipients adds wrapped copies.
  • Format dependence: The exact structure is set by the format or protocol, such as the message structures of older cryptographic message standards, so the same idea can look different across tools.
  • Public-key operation scope: Only the short symmetric key passes through the public-key operation, while the message body is handled symmetrically.
  • Post-quantum migration: Replacing the public-key operation inside this pattern depends on the format supporting a new algorithm, which is why format versions matter.

Before relying on this pattern in a post-quantum design, check which exact format, library version and recipient structure your systems use, and confirm with the vendor documentation whether it can carry a post-quantum key-establishment algorithm.

How a message carries an encapsulated key

The diagram starts with the sender calling Encap on the recipient's public key, which returns an encapsulation and a fresh shared secret. The key schedule then derives the AEAD key from that secret, and the sender encrypts the message with it. The encapsulation travels with the ciphertext, and the recipient calls Decap with their private key to recover the same shared secret and derive the same AEAD key. This is a simplified illustration of the flow in RFC 9180, not a full protocol diagram. Compare it with a traditional design, where a symmetric key is encrypted with the recipient's public key and sent as a wrapped key.

Simplified illustration of the HPKE flow in RFC 9180, not a full protocol diagram.

Which differences change a design decision

A KEM and public-key encryption solve the same problem in different ways, and the differences show up in message format, mode selection and what each standard expects from you. The cards below cover the decisions that follow from those differences, so you can check each one against the standard or product you plan to use.

The KEM outputs a shared secret

A KEM does not take a key you chose and carry it to the recipient. Encapsulation generates a fresh shared secret and an encapsulation of it under the recipient's public key, and decapsulation recovers that secret with the private key. Your design must derive the symmetric key from that secret rather than expecting to transport one. Confirm how your library exposes the shared secret before writing key-handling code, since the caller is responsible for what happens next.

RFC 9180 text

The encapsulation travels with the message

In a KEM-based message, the encapsulated key is carried alongside one or more ciphertexts encrypted under the derived key, so the recipient needs both parts to read the message. Storage and wire formats must have a field for the encapsulation, and parsers must handle its length. Check the encapsulation size for your chosen parameter set against the format you are extending, because it differs from the size of a classical encrypted key.

HPKE keeps the KDF and AEAD separate

In HPKE, the KEM, KDF and AEAD are independent inputs to the scheme, so a KEM choice does not fix the other two. An implementation must pick a KDF and an AEAD that the chosen KEM and profile support. Compare the cipher suite identifiers your peers use, because two systems that both claim HPKE can still disagree on the KDF or AEAD and fail to interoperate.

HPKE PQ draft

Auth modes need AuthEncap and AuthDecap

The HPKE Auth and AuthPSK modes require a KEM that provides AuthEncap and AuthDecap, which bind the sender's identity into the shared secret. A KEM that offers only plain encapsulation cannot be used in those modes. Before choosing an authenticated mode, confirm that the KEM you plan to deploy defines these operations, and check the draft or product documentation for the KEM identifiers it supports.

CMS needs a fresh secret per recipient

Under RFC 9629, the originator must generate a fresh KEM shared secret for each recipient and both sides must discard it after use. A multi-recipient message therefore runs encapsulation once per recipient rather than reusing one secret. Design your CMS handling so that secrets are not cached or persisted beyond the operation, and verify that your toolchain follows the discard requirement.

RFC 9629 text

Key wrapping differs from encapsulation

Key wrapping protects an existing content-encryption key by encrypting it under a key-encryption key, while encapsulation produces the key-encryption material itself from a KEM operation. Under RFC 9629, the KEM output feeds a KDF that derives the key-encryption key used to wrap the content key. Architects reviewing an existing wrapping design should identify which step the KEM replaces, because the key lifecycle and storage requirements change with it.

Where KEMs and public-key encryption appear in protocols and products

If you are reviewing a product or protocol, the fastest way to tell a KEM design from a classic public-key encryption design is to find where the sender's symmetric key comes from. In HPKE, defined in RFC 9180, the sender generates the symmetric key together with its encapsulation under the recipient's public key, using the Encap operation, and the recipient recovers it with Decap. The message then carries an encapsulated key plus one or more ciphertexts under that key. The draft draft-ietf-hpke-pq-05, dated 6 July 2026 and still an Active Internet-Draft, adds post-quantum and hybrid KEMs to HPKE and lists the KEM identifiers 0x0040 (ML-KEM-512), 0x0041 (ML-KEM-768), 0x0042 (ML-KEM-1024), 0x0050 (MLKEM768-P256), 0x0051 (MLKEM1024-P384) and 0x647a (MLKEM768-X25519). Confirm which identifiers, if any, your HPKE library implements, since a draft is not a final standard.

In CMS, RFC 9629 (August 2024, Standards Track, updating RFC 5652) provides the same pattern through a KEMRecipientInfo structure identified by id-ori-kem. The originator generates a random content-encryption key, runs KEM Encapsulate for each recipient, derives a key-encryption key from the shared secret with a KDF, and places the wrapped content-encryption key in encryptedKey. RFC 9629 requires a fresh KEM shared secret for each recipient and requires both sides to discard it after use. Check whether your S/MIME, document signing or enveloped-data tooling reads id-ori-kem recipient info, because older CMS parsers will not recognize it.

For TLS 1.3, RFC 10024 (August 2026, Standards Track) defines the hybrid named groups X25519MLKEM768 (4588, 0x11EC, marked Recommended Y), SecP256r1MLKEM768 (4587, 0x11EB, Recommended N) and SecP384r1MLKEM1024 (4589, 0x11ED, Recommended N). RFC 9954 explains the purpose of such hybrids: the session key stays secure while at least one component is unbroken, which matters because recorded traffic could be decrypted later. The key shares are large, with X25519MLKEM768 sending 1216 bytes from the client and 1120 bytes from the server, so check that load balancers, middleboxes and TLS stacks accept these sizes. The ML-KEM parameter sets come from FIPS 203, which defines ML-KEM-512, ML-KEM-768 and ML-KEM-1024 in order of increasing security strength and decreasing performance. Confirm in your own product versions which named groups and ML-KEM sets are actually enabled and offered by default.

How to work out which approach applies to your system

This sequence establishes whether your system needs a KEM-based design, a public-key encryption scheme built from a KEM, or a classical key wrap, and records which identifiers and versions your vendors support. The output is a documented decision you can test against the protocol or format your system must follow.

  1. Identify the protocol or format your design must follow

    Start by listing every protocol or message format that carries keys in your system, such as TLS 1.3, CMS, or HPKE. For each one, read the governing RFC to see whether it defines a KEM-based mechanism at all. RFC 9180 defines HPKE as a public key encryption scheme built from a KEM, a KDF and an AEAD, and RFC 9629 defines a KEMRecipientInfo structure for CMS. Record which RFC applies to each system and which mode or structure it specifies. You are done when each protocol in scope has a named RFC and a recorded KEM or non-KEM mechanism.

  2. Check contracts and customer requirements for named standards

    Review the contracts, tender documents and customer security requirements that govern this system for any named standard or required construction. A customer may name HPKE, CMS or a specific TLS named group, and that naming determines which approach you must implement. Ask the contract owner to confirm in writing any standard they require, and note any requirement that is ambiguous. You are done when each named standard is recorded against the system it governs, or when the file confirms that no standard is named.

  3. Inventory where keys are wrapped and where they are encapsulated

    Walk through your key management and transport paths and label each place a key moves. Where a symmetric key is encrypted under a recipient's public key as a wrap, mark it as wrapping. Where a fresh shared secret is generated and encapsulated for a recipient, as in the RFC 9180 Encap and Decap functions, mark it as encapsulation. Note the algorithm and its parameter set wherever you can read it from configuration. You are done when every key transport path in scope carries exactly one label and an owner who can confirm it.

  4. Confirm KEM identifiers and versions in vendor documentation

    For each product in the inventory, read the vendor documentation for the KEM identifiers and protocol versions it supports. Compare what the vendor lists against the identifiers in the relevant specification, such as the HPKE KEM identifiers in draft-ietf-hpke-pq, or the TLS 1.3 hybrid named groups in RFC 10024. Record the exact version and build you are relying on, because support often differs by release. Where the vendor documentation does not list an identifier, record that gap rather than assuming support. You are done when each product has a written list of supported identifiers and versions, each tied to a documented source.

  5. Test interoperability in your own environment

    Before any rollout, build a test environment that mirrors your production protocol stack and run a handshake or message exchange between the components that must interoperate. Confirm that both sides agree on the KEM, the mode and the named group, and that a failed negotiation falls back or fails in the way your design requires. Record the versions and identifiers used in each test run. Do not assume that two products listing the same identifier are interoperable, and confirm compatibility for the exact versions you run. You are done when a test log shows each interoperating pair completing an exchange with recorded versions.

Common mix-ups between KEMs and public-key encryption

A key encapsulation mechanism (KEM) produces a shared secret and an encapsulation of it, and does not encrypt a message by itself. The mix-ups below come up most often when teams read a protocol document, a vendor datasheet or an HPKE configuration and assume the KEM covers more than it does.

KEM is not public-key encryption alone

A KEM gives you Encap and Decap, which establish a shared secret. Public-key encryption of a message also needs a KDF to derive keys and an AEAD to encrypt the data. RFC 9180 defines HPKE as a public-key encryption scheme built from a KEM, a KDF and an AEAD, so the KEM is one of three parts. When a design says it uses a KEM, check whether the KDF and AEAD are specified too.

RFC 9180

KEM is not key wrapping

Key wrapping moves an existing symmetric key under another key. A KEM generates a fresh shared secret for each use and returns an encapsulation of it. RFC 9629 shows the two can meet in CMS: the originator generates a random content-encryption key, runs KEM Encapsulate per recipient, derives a key-encryption key and wraps the content key in encryptedKey. The KEM and the wrap are separate steps, so check which one a spec describes.

RFC 9629

KEM alone does not encrypt messages

A KEM output is a shared secret, not ciphertext of your data. The message is encrypted only after the secret feeds a key schedule that derives an AEAD key and nonce, as RFC 9180 describes for HPKE setup. Systems that take a KEM and stop there leave the payload unprotected, so confirm that an encryption layer exists on top of the KEM in your design.

RFC 9180

HPKE modes versus KEM choice

HPKE defines four modes: Base, PSK, Auth and AuthPSK. Choosing a KEM and choosing a mode are separate decisions. RFC 9180 says the Auth modes need a KEM that supports AuthEncap and AuthDecap, so a KEM that lacks those operations cannot serve an Auth mode. Check the mode and the KEM identifier together in any HPKE configuration.

RFC 9180

ML-KEM parameter sets are not interchangeable

FIPS 203 defines ML-KEM-512, ML-KEM-768 and ML-KEM-1024. They are listed in order of increasing security strength and decreasing performance. The names look alike, but each one sets different key and ciphertext sizes. Confirm which set a product and a peer use, since a mismatch fails the exchange. The TLS hybrid groups in RFC 10024 pair ML-KEM-768 and ML-KEM-1024 with different classical halves, so the name alone does not identify the group.

FIPS 203

Draft identifiers are not final standards

draft-ietf-hpke-pq-05 lists KEM identifiers such as 0x0040 for ML-KEM-512, but it is an Active Internet-Draft, not a published RFC, and it can change before it is finalized. An identifier taken from a draft may be renamed or withdrawn. Before deploying, check whether the identifier appears in a published RFC and confirm what the peer implements.

Draft status page

Questions people ask about KEMs and public-key encryption

Are a KEM and public-key encryption the same thing?

No. The sources treat them as related but different. Traditional public-key encryption encrypts a symmetric key with the recipient's public key, and the message is then encrypted under that symmetric key. A key encapsulation mechanism (KEM) instead produces a fresh shared secret together with an encapsulation of it under the public key, with Encap on the sender side and Decap on the recipient side, as RFC 9180 defines them. HPKE combines a KEM, a KDF and an AEAD to build a public key encryption scheme for arbitrary-length plaintexts, so a KEM is one building block inside encryption rather than a full encryption scheme on its own.

Which is newer, a KEM or public-key encryption?

The sources do not say which concept appeared first, so this page does not rank them by age. What the sources do date is the standards around KEMs. NIST published FIPS 203, which standardizes ML-KEM, on 13 August 2024. NIST SP 800-227, Recommendations for Key-Encapsulation Mechanisms, was finalized in September 2025. RFC 9180, which defines HPKE, is dated February 2022. The sources on this page do not give a history of public-key encryption, so check that against a standard or textbook if you need it.

Does a system need both a KEM and public-key encryption?

The sources do not say that a system must use both. HPKE is built from a KEM, which means the KEM sits inside a public-key encryption scheme rather than alongside it. RFC 9629 shows a different case: CMS can use a KEM through a KEMRecipientInfo structure, where the content-encryption key is wrapped using a key derived from the KEM shared secret. Whether your design needs one, the other, or a composition depends on the protocol you run and the standard it follows. Confirm the required combination against the specification for that protocol.

What does HPKE use a KEM for?

HPKE uses a KEM to establish the shared secret that drives its key schedule. In RFC 9180 the setup functions call Encap on the sender side or Decap on the recipient side, and a key schedule then derives the AEAD key, base nonce and exporter secret used to encrypt messages. HPKE defines four modes, Base, PSK, Auth and AuthPSK, and the Auth modes need a KEM that supports AuthEncap and AuthDecap. The draft for post-quantum and hybrid KEMs in HPKE, draft-ietf-hpke-pq-05, is an Active Internet-Draft and has not been published as a standard.

Does a KEM encrypt a message by itself?

The sources describe a KEM as producing a shared secret and an encapsulation of it, not as encrypting a message. RFC 9180 defines Encap, which produces a fresh shared secret and its encapsulation, and Decap, which recovers the shared secret with the private key. NIST SP 800-227 describes a KEM as a way for two parties to establish a shared secret key over a public channel for use with symmetric-key algorithms. Message encryption then happens with a symmetric algorithm keyed by that secret. In HPKE that step is handled by the AEAD, so a KEM alone does not encrypt a message.

Which standard defines ML-KEM?

FIPS 203 from NIST standardizes ML-KEM as a key-encapsulation mechanism. It specifies three parameter sets: ML-KEM-512, ML-KEM-768 and ML-KEM-1024, listed in order of increasing security strength and decreasing performance. The sources cite FIPS 203 as published on 13 August 2024. ML-KEM is a KEM, so it fits the encapsulation roles described in RFC 9180 and NIST SP 800-227. The sources do not say which parameter set your product uses by default, so confirm that in the vendor's documentation.

What should I ask a vendor about KEM and public-key encryption support?

Ask which standard their KEM follows, such as FIPS 203 for ML-KEM or an HPKE KEM identifier from draft-ietf-hpke-pq, and which parameter set they run. Ask whether they use the KEM as a building block inside HPKE or CMS, or as a standalone component, and which mode applies. Ask for the version of each standard they implement, since drafts and published RFCs differ in status. Ask how they generate the shared secret for each recipient and how they discard it after use, which RFC 9629 requires. Ask which parts of their stack are covered and which are not, and request written evidence for each answer.

How DeployOpen works on this

DeployOpen works through KEM and key exchange design in four stages, starting from a written scope and ending with documentation your engineers can keep. The work covers the protocols and products you run, with each design decision tied to the specific standard or draft that defines it.

How we scope

  • Engagements are fixed-scope, with the systems, protocols and KEM parameter sets agreed in writing before work starts.
  • The scope records which key exchange role each component plays, separating KEM use from key agreement and from signatures.
  • Scope documents list the standards referenced, such as FIPS 203 and RFC 9180, so reviewers can check each design choice against its source.

How we build

  • Designs follow the identifiers and encodings defined in the cited specifications, such as HPKE KEM identifiers and CMS KEMRecipientInfo structures.
  • Each recipient gets a fresh encapsulation, and the shared secret is handled as RFC 9629 requires, with the scope naming where this applies.
  • Implementations are tested against the specification and interoperability is confirmed for the exact versions and libraries you run.

How we hand over

  • Handover includes written documentation of the KEM design, the key derivation steps and the configuration values chosen.
  • Documentation maps each design decision to the RFC or NIST publication that defines it, so auditors can trace the source.
  • Your engineers receive the test results and a list of open questions to confirm against the vendor documentation for your versions.

How we support

  • Ongoing support is available as a retainer for upgrades, updated drafts and changes to protocol versions after handover.
  • Retainers can cover retesting when a referenced draft changes, such as successive revisions of draft-ietf-hpke-pq.
  • Support scope is agreed in writing, so the boundaries of what is covered, and what your team owns, are clear from the start.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.