Skip to main content
Glama

CipherHUB Cryptography Toolkit

hybrid_kex

Read-only

[pqc_kem] 执行 X25519 + ML-KEM-768 混合密钥交换全流程演示。 【设计灵感】参考 IETF X-Wing 草案(draft-connolly-cfrg-xwing-kem)的思路,本工具实现的是通用拼接组合器(ecdh_ss || ml_kem_ss → HKDF-SHA256),并非 X-Wing 规范本身的组合器。 【参数】所有密钥参数均可选:

  • alice_x25519_private_key_pem / bob_x25519_private_key_pem:X25519 PEM 私钥

  • alice_ml_kem_public_key_base64 / bob_ml_kem_public_key_base64:ML-KEM-768 公钥,支持 raw 或 SPKI DER Base64

  • alice_ml_kem_secret_key_base64 / bob_ml_kem_secret_key_base64:ML-KEM-768 私钥,支持 raw 或 PKCS#8 DER Base64

  • ML-KEM 公钥和私钥必须同时提供;留空则服务端使用 CSPRNG 随机生成 raw keypair 【流程】

  1. Alice 和 Bob 各持有 X25519 + ML-KEM-768 密钥对

  2. Alice 用 Bob 公钥做 X25519 ECDH + ML-KEM Encap

  3. Bob 用自己私钥做 X25519 ECDH + ML-KEM Decap

  4. 双方将 ecdh_ss || ml_kem_ss 通过 HKDF-SHA256 派生 32 字节最终密钥 【输出】双方中间值 + 最终密钥 + keys_match(bool)验证一致性。 【安全等级】组合后达到 NIST Level 3(ML-KEM-768)+ Level 1(X25519),抵抗经典和量子攻击。

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "hybrid_kex"
  }
}

Input Schema

NameRequiredDescriptionDefault
bob_x25519_public_key_pemNo
bob_x25519_private_key_pemNoBob 侧 X25519 私钥的 PEM 文本
alice_x25519_public_key_pemNo
alice_x25519_private_key_pemNoAlice 侧 X25519 私钥的 PEM 文本
bob_ml_kem_public_key_base64NoBob 侧 ML-KEM 公钥的 Base64 字符串(raw 或 SPKI DER)
bob_ml_kem_secret_key_base64NoBob 侧 ML-KEM 私钥的 Base64 字符串(raw 或 PKCS#8 DER)
alice_ml_kem_public_key_base64NoAlice 侧 ML-KEM 公钥的 Base64 字符串(raw 或 SPKI DER)
alice_ml_kem_secret_key_base64NoAlice 侧 ML-KEM 私钥的 Base64 字符串(raw 或 PKCS#8 DER)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changed
    • addedInput schema / properties / alice_ml_kem_public_key_base64 / description
      Added value: +"Alice 侧 ML-KEM 公钥的 Base64 字符串(raw 或 SPKI DER)"
    • addedInput schema / properties / alice_ml_kem_secret_key_base64 / description
      Added value: +"Alice 侧 ML-KEM 私钥的 Base64 字符串(raw 或 PKCS#8 DER)"
    • addedInput schema / properties / alice_x25519_private_key_pem / description
      Added value: +"Alice 侧 X25519 私钥的 PEM 文本"
    • addedInput schema / properties / bob_ml_kem_public_key_base64 / description
      Added value: +"Bob 侧 ML-KEM 公钥的 Base64 字符串(raw 或 SPKI DER)"
    • addedInput schema / properties / bob_ml_kem_secret_key_base64 / description
      Added value: +"Bob 侧 ML-KEM 私钥的 Base64 字符串(raw 或 PKCS#8 DER)"
    • addedInput schema / properties / bob_x25519_private_key_pem / description
      Added value: +"Bob 侧 X25519 私钥的 PEM 文本"
  2. Changed1 schema field changed
    • changedInput schema / description
      Previous value: -"X25519 + ML-KEM-768 混合密钥交换请求。\n\n所有密钥字段均可选:\n- 若留空,服务端随机生成\n- 若传入,服务端使用传入的密钥对进行协商\n\nAlice 侧字段:\n- alice_x25519_private_key_pem: Alice X25519 私钥 (PEM)\n- alice_x25519_public_key_pem:  Alice X25519 公钥 (PEM)\n- alice_ml_kem_public_key_base64: Alice ML-KEM 公钥 (Base64)\n- alice_ml_kem_secret_key_base64: Alice ML-KEM 私钥 (Base64)\n\nBob 侧字段同理。"New value: +"X25519 + ML-KEM-768 混合密钥交换请求。\n\n所有密钥字段均可选:\n- 若留空,服务端随机生成\n- 若传入,服务端使用传入的密钥对进行协商\n\nAlice 侧字段:\n- alice_x25519_private_key_pem: Alice X25519 私钥 (PEM)\n- alice_x25519_public_key_pem:  Alice X25519 公钥 (PEM,仅展示/回填)\n- alice_ml_kem_public_key_base64: Alice ML-KEM 公钥 (raw 或 SPKI DER Base64)\n- alice_ml_kem_secret_key_base64: Alice ML-KEM 私钥 (raw 或 PKCS#8 DER Base64)\n\nBob 侧字段同理。若传入 ML-KEM key,公钥和私钥必须同时提供;响应保持 raw key Base64 以兼容演示流程。"
  3. First observed

TDQS

A3.7/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true and openWorldHint=false, and nothing in the description contradicts that — the tool is a pure computation. Beyond the annotations the description adds real behavior: server-side CSPRNG keypair generation when fields are blank, HKDF-SHA256 over ecdh_ss || ml_kem_ss, a keys_match consistency flag in the response, and the resulting NIST security levels. It does not say anything about handling of the supplied private keys (e.g., whether they are logged or discarded), which is the one notable gap for a tool that accepts secrets.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Bracketed headers (参数 / 流程 / 输出 / 安全等级) make it skimmable and the purpose is front-loaded. However, the 参数 block restates all eight schema descriptions nearly verbatim, which is the bulk of the length and does not earn its place given 75% schema coverage; a one-line pointer plus the mutual-requirement rule would suffice.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For an eight-parameter tool with no output schema this is close to complete: it names the response contents (intermediate values, final key, keys_match boolean), the derivation steps, and the security profile. Remaining gaps are error behavior (e.g., mismatched or malformed keys) and the fate of supplied private keys.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 75% and the description still adds meaning beyond it: accepted encodings (raw or SPKI DER for ML-KEM public keys, raw or PKCS#8 DER for secrets), the all-optional/auto-generate default, and the cross-field constraint that ML-KEM public and secret keys must be provided together. Much of the per-parameter listing duplicates the schema text, but the constraint and fallback semantics are genuinely new.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The opening line names the exact primitives and the operation: X25519 + ML-KEM-768 hybrid key exchange, full demonstration flow. The 【设计灵感】 note carefully distinguishes it from the X-Wing spec (generic concatenation combiner, not X-Wing's combiner), which prevents a real misidentification. It does not, however, contrast itself with the sibling ecc_key_exchange, leaving the agent to infer which exchange tool to pick.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is only implied — the flow steps and the note that all key fields are optional (server falls back to CSPRNG-generated keypairs) hint at demo/self-contained use, and one hard precondition is stated (ML-KEM public and secret keys must be supplied together). There is no explicit when-to-use/when-not statement and no named alternative such as ecc_key_exchange or ml_dsa_keygen.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.