NodeCrypto Help

Hybrid KEM Encapsulate

Category: Post-Quantum Cryptography ยท Node Type ID: pqc-hybridkem-encaps

Encapsulates shared secret using hybrid X25519 + ML-KEM-768 recipient public key

Overview

Performs hybrid key encapsulation against a recipient's 1,216-byte X25519 + ML-KEM-768 public key: generates an ephemeral X25519 keypair to compute the X25519 ECDH shared secret, encapsulates an ML-KEM-768 shared secret, and combines both shared secrets via SHA-256 / HKDF into a single 32-byte Shared Secret.

Emits the 32-byte combined Shared Secret alongside the 1,120-byte Hybrid Ciphertext (32B ephemeral X25519 public key || 1,088B ML-KEM-768 ciphertext).

When to Use

Parameter Configuration

Hybrid KEM Encapsulate has no configurable parameters.

Port I/O Specification

See Ports & Connections for general wiring rules, data type colors, and dynamic port creation.

Input Ports

Port Nature: Fixed Input Ports (1 total).

Port NamePort IDData TypeRequiredVisibility ConditionDescription
Recipient Public Key publicKey Bytes Required Always visible Recipient's 1,216-byte Hybrid Public Key.

Output Ports

Port Nature: Fixed Output Ports (2 total).

Port NamePort IDData TypeVisibility ConditionDescription
Shared Secret sharedSecret Bytes (Combined) Always visible Combined 32-byte shared secret derived from both X25519 and ML-KEM-768 components.
Hybrid Ciphertext ciphertext Bytes Always visible 1,120-byte composite ciphertext (32B X25519 ephemeral public key || 1,088B ML-KEM-768 ciphertext).

Error Cases

When any of the following conditions occurs at runtime, this node transitions to an ERROR state and downstream nodes connected to its outputs do not execute.

Error CodeDefault Engine MessageTrigger Condition
INVALID_KEY_MATERIAL Invalid key length or format Raised when Recipient Public Key is not 1,216 bytes or contains an invalid ML-KEM-768 / X25519 public key component.

Examples

Hybrid Key Encapsulation for AES-256-GCM

Encapsulate a 32-byte hybrid key and use it to encrypt a message.

  1. Connect Hybrid Public Key from Hybrid KEM KeyGen to Recipient Public Key.
  2. Wire Shared Secret to AES Encrypt and Hybrid Ciphertext to Hybrid KEM Decapsulate.