← Back to section · Post-Quantum Cryptography
Inside the McEliece System: A Complete Walk from Key Generation to KEM Encapsulation
Take Classic McEliece apart piece by piece: how an irreducible polynomial and a support set generate the key, the systematic-form public key, fixed-weight error vectors, implicit rejection, and how a public-key encryption scheme becomes a CCA-secure KEM.
The layer the overview did not cover
The overview explained McEliece’s idea: hide a good code, and let decryption be error correction. But to understand why this system can be turned into a modern KEM, you have to go one level down: what does a key actually look like, what exactly is a ciphertext, and what happens on failure? The Classic McEliece specification pins down every one of these details — its design philosophy is “every random choice is determinized by a seed, and every failure path is sealed off,” which is exactly why a forty-year-old scheme can pass modern security review.
Key generation: three secret components
Key generation starts from a random seed and deterministically expands it into three things. First, a finite field (with parameter equal to 12 or 13), the algebraic stage behind the codeword coordinates. Second, a monic irreducible polynomial of degree , which defines the binary Goppa code — irreducibility guarantees a minimum distance of at least , i.e., the ability to correct errors. Third, a support set: distinct field elements arranged in a sequence, which determines which field element corresponds to each codeword coordinate — in effect, the permutation that pins the code onto the coordinate system.
From these three components one computes the code’s parity-check matrix and reduces it by Gaussian elimination to systematic form : the identity matrix on the left, and the dense matrix on the right is the entire content of the public key. The private key, by contrast, only needs to store the seed and those three components, and is tiny — the bulk sits entirely on the public side, which is why all storage pressure in this system lands on the public key. Key generation also includes a self-check: if elimination fails (the matrix is not full rank), a new seed is tried; this check simultaneously guarantees that the public key is well-defined.
Encryption: the art of fixed weight
In the Niederreiter form, encryption is no longer “encode a message and add errors.” Instead: choose a random binary vector of length containing exactly ones, compute the syndrome , and the syndrome is the ciphertext. The weight must be exactly , no more, no less — this is not pedantry: if the weight could vary, an attacker could read information from the ciphertext distribution, and implementers might cut corners on randomness. Fixed-weight sampling therefore uses a dedicated constant-time algorithm that generates the pattern deterministically from a seed stream, guaranteeing that every encapsulation’s error pattern is beyond reproach.
The ciphertext thereby becomes extremely small: a syndrome is on the order of bits, one to two hundred bytes. The decryptor, using the private key to rebuild the Goppa code, performs algebraic decoding on the syndrome to recover — decoding succeeds if and only if the weight does not exceed the correction radius, which reduces the cryptographic problem cleanly to an error-correction problem.
From encryption to KEM: determinism and implicit rejection
Raw McEliece encryption is only one-way; three moves close the gap to IND-CCA security. First, all randomness in encapsulation is expanded from a random seed via hashing, so the decapsulator can recompute the entire encryption process and compare the ciphertext bit by bit — accepting only on an exact match. This deterministic re-encryption check turns “is this ciphertext legitimate” into a verifiable fact. Second, the session key is not the error vector itself; the error vector is hashed together with the ciphertext to derive it, binding it to the context. Third — the move most often overlooked — implicit rejection. If the re-encryption comparison fails, decapsulation does not return an error; instead it hashes the received ciphertext with a secret seed stored in the private key and outputs a perfectly normal-looking pseudorandom key. The caller cannot distinguish success from failure, so carefully crafted malformed ciphertexts extract no information at all — the entire feedback channel for chosen-ciphertext attacks is sealed.
Reading the parameter names, and a sense of scale
A Classic McEliece parameter-set name is itself a parameter table: mceliece348864 reads as code length with errors corrected; 460896 means , ; 6688128 and 8192128 are the two Level-5 variants with , differing in code length. The code length fixes the number of columns of the public key, while and the field size fix the number of rows of the parity-check matrix (on the order of ); their product is the source of the public key’s volume — which explains why each step up in security level makes the public key jump so sharply: the level demands that and grow simultaneously, and the key size is proportional to their product. Another noteworthy design choice is that all parameter sets sit at the high-rate end, with close to ; this once drew discussion in connection with the Goppa code distinguishing problem, and the specification’s answer is to count the safety margin directly into the parameters — preferring a somewhat larger public key over letting structural questions drift into unassessed regimes. This orientation of “buying peace of mind with volume” runs through the entire parameter table.
Implementation pitfalls
The system’s implementation demands concentrate in three places. Decoding must be constant-time: if the execution path of a Patterson-style algorithm varies with the error positions, timing side channels can leak the private structure bit by bit. Key generation must handle low-probability events such as elimination failure and reducible polynomials with branches that do not depend on secret data. And although systematic form already cuts the public key volume substantially, its transport and caching remain an engineering topic — but that belongs to a separate article on size engineering. Here it suffices to remember: half of McEliece’s security is written in the mathematics, and the other half in these seemingly tedious implementation disciplines.
Closing
Taken apart, the modern form of Classic McEliece is: seeded key generation, a systematic-form public key, fixed-weight syndrome ciphertexts, deterministic re-encryption verification, and implicit rejection. The 1978 skeleton is unchanged; what changed is the engineering attitude that folds every source of randomness and every failure path into the specification — that is the whole story of how a short paper grew into an auditable standard.
Tags: Classic McElieceKEMKey GenerationCCA Security