QianHeng乾珩 PQC Docs Hub量子文档 ✦ Ask AI✦ 问问文档 ⚐ Scan⚐ 扫一扫

Classic McEliece

Classic McEliece is a code-based key-encapsulation mechanism built on binary Goppa codes. A NIST Round-4 candidate not selected by NIST; it is on the ISO/IEC standardization track, not the NIST FIPS track. It is prized for its extreme conservatism — the underlying problem has resisted attack since 1978 — and for tiny ciphertexts, at the price of enormous public keys.

How it works

Classic McEliece is a KEM whose security rests on the hardness of decoding a random-looking linear code. The public key is a scrambled generator/parity-check matrix for a binary Goppa code; the private key is the structured description that allows efficient decoding. Encapsulation encodes a random error vector and derives a shared secret; decapsulation uses the secret Goppa structure to decode the error and recover the secret.

The original McEliece scheme dates to 1978 and has survived more than forty-five years of cryptanalysis essentially intact — an unusually strong track record. "Classic McEliece" is the modern, IND-CCA2-secure KEM packaging of that idea.

Parameter sets

Sizes vary widely across parameter sets. Note the contrast: ciphertexts are tiny, but public keys are hundreds of kilobytes to over a megabyte. Approximate values in bytes. Classic McEliece has many parameter sets, and different document versions keep different recommended sets; overall the public keys range from about 255 KB to 1.3 MB and the ciphertexts from about 96 to 208 bytes.

Parameter setSecurity levelPublic key (approx.)Ciphertext (approx.)
mceliece348864Category 1261120 (~255 KB)96
mceliece460896Category 3524160 (~512 KB)156
mceliece6960119Category 5~1047319 (~1 MB)194
mceliece8192128Category 5~1357824 (~1.3 MB)208

Strengths & tradeoffs

  • Extremely conservative. Unbroken since 1978; the security assumption is among the most trusted in all of cryptography.
  • Tiny ciphertexts. Only ~96-208 bytes — smaller than ML-KEM ciphertexts — which is great for high-volume encapsulation traffic.
  • Tradeoff — huge public keys. 255 KB to over 1 MB. This makes it unsuitable for protocols that transmit a fresh public key per handshake (like ephemeral TLS), but acceptable when keys are long-lived and distributed infrequently.

When to use it

Classic McEliece shines when the public key can be installed once and reused for a long time — pinned keys, pre-provisioned devices, or static infrastructure endpoints — and you want the strongest possible confidence in long-term confidentiality (defending against Harvest Now, Decrypt Later). For general ephemeral key exchange where keys are sent per connection, prefer ML-KEM or the code-based HQC.

Code example

import oqs

kem = "Classic-McEliece-348864"
with oqs.KeyEncapsulation(kem) as server:
    public_key = server.generate_keypair()
    print("public key bytes:", len(public_key))  # ~261120 (~255 KB!)

    with oqs.KeyEncapsulation(kem) as client:
        ciphertext, ss_c = client.encap_secret(public_key)
        print("ciphertext bytes:", len(ciphertext))  # ~96

    ss_s = server.decap_secret(ciphertext)
    assert ss_c == ss_s
Warning
A single Classic McEliece public key can exceed 1 MB. Do not transmit it in latency-sensitive or per-connection handshakes — buffer sizes, MTUs, and memory budgets may break. Reserve it for scenarios where the public key is provisioned out-of-band and reused over a long lifetime.

Related

Standards & references

Classic McEliece

Classic McEliece 是一种基于编码的密钥封装机制,建立在二元 Goppa 码之上。作为 NIST 第四轮候选,NIST 未推进;它走 ISO/IEC 标准化路线,不在 NIST FIPS 轨道上。它以极致的保守性著称——底层问题自 1978 年起从未被攻破——并拥有极小的密文,代价是巨大的公钥。

工作原理

Classic McEliece 是一种 KEM,其安全性建立在解码一个看似随机的线性码之困难性上。公钥是一个被扰乱的二元 Goppa 码生成/校验矩阵;私钥则是能高效解码的结构化描述。封装时编码一个随机错误向量并导出共享密钥;解封装时利用秘密的 Goppa 结构解码该错误并还原密钥。

原始 McEliece 方案可追溯至 1978 年,历经四十五年以上密码分析基本毫发无损——这是极为罕见的优异记录。“Classic McEliece”正是这一思想的现代化、满足 IND-CCA2 的 KEM 封装。

参数集

各参数集尺寸差异巨大。请注意反差:密文极小,公钥却达数百 KB 乃至超过 1 MB。下表为近似字节值。Classic McEliece 参数集较多,不同文档版本会保留不同推荐集;总体范围是公钥约 255 KB 到 1.3 MB,密文约 96 到 208 字节。

参数集安全等级公钥(约)密文(约)
mceliece348864等级 1261120(约 255 KB)96
mceliece460896等级 3524160(约 512 KB)156
mceliece6960119等级 5约 1047319(约 1 MB)194
mceliece8192128等级 5约 1357824(约 1.3 MB)208

优势与取舍

  • 极致保守。自 1978 年从未被攻破;其安全假设跻身整个密码学中最受信赖之列。
  • 密文极小。仅约 96-208 字节——小于 ML-KEM 密文——非常适合高频封装流量。
  • 取舍——巨大公钥。255 KB 至 1 MB 以上。这使其不适合每次握手都传输新公钥的协议(如临时 TLS),但在公钥长寿命、低频分发时可接受。

适用场景

当公钥可一次安装、长期复用时,Classic McEliece 表现出色——固定(pinned)密钥、预置设备、或静态基础设施端点——且你希望获得对长期机密性的最强信心(抵御“先收集后解密”)。对于每次连接都发送公钥的通用临时密钥交换,请优先选用 ML-KEM 或基于编码的 HQC

代码示例

import oqs

kem = "Classic-McEliece-348864"
with oqs.KeyEncapsulation(kem) as server:
    public_key = server.generate_keypair()
    print("公钥字节:", len(public_key))  # 约 261120(约 255 KB!)

    with oqs.KeyEncapsulation(kem) as client:
        ciphertext, ss_c = client.encap_secret(public_key)
        print("密文字节:", len(ciphertext))  # 约 96

    ss_s = server.decap_secret(ciphertext)
    assert ss_c == ss_s
警告
单个 Classic McEliece 公钥可超过 1 MB。切勿在时延敏感或每连接握手中传输——缓冲区大小、MTU 与内存预算都可能被撑爆。请仅在公钥带外预置并长期复用的场景中使用。

相关页面

标准与参考

⚑ Report an error⚑ 纠错与校正