INNER · McELIECE.PKE.KEYGEN — offline, owner only
01
🔐 Sample the Goppa code
Sample a random monic irreducible g(X) of degree t, and n distinct field elements α₁,…,αₙ. This pair is the private key sk = (g(X), α).
↓
02
📐 Build & reduce the parity-check matrix
Construct the private parity-check matrix from g(X), α. Row-reduce it to systematic form to get the public key H′. (If reduction fails, restart from step 01 — a known quirk of the scheme.)
📤 H′ is published — this is the public key anyone can use to encrypt to the owner
OUTER · McELIECE.KEM.ENC — sender, using public key only
03
🎲 Sample the error vector
Sender samples a uniformly random weight-t vector e — this plays the role of the "glitter pattern," and it is what actually gets encrypted, not the message.
↓
04
🔒 Inner encryption — C₀ = PKE.Enc(pk, e)
Reconstruct H from H′ and compute C₀ = H·eᵀ. This single call is the entire inner PKE layer from Part 1.
↓
05
🧾 Bind & derive — C₁, session key K
C₁ = Hash(2 ∥ e) binds the error vector to a tamper-evident tag. K = KDF(1 ∥ e ∥ C₀ ∥ C₁) derives the shared session key. Sender transmits the ciphertext (C₀, C₁) — never K itself.
🏁 Shared session key established — 8 steps total
Sender and receiver now hold the same K — derived, never transmitted. The message itself was never touched by McEliece; K goes on to encrypt real data with a symmetric cipher, while the attacker is still stuck searching.
Steps 01–02 KeyGen · Steps 03–05 KEM.Enc · Step 06 Attacker · Steps 07–08 KEM.Dec — matches the 8-step worked demo in Part 3.