Skip to main content
Glama

CipherHUB Cryptography Toolkit

key_derivation

Read-only

[kdf] 执行密钥派生(KDF),从高熵秘密或口令派生对称密钥材料。 【支持算法】

  • HKDF(默认):RFC 5869 extract-then-expand,底层哈希 Sha256(默认)/ Sha384 / Sha512

  • Sm3Kdf:GB/T 32918 密钥派生,SM3(Z ∥ be32(ct)),ct 从 1 起,适合对 SM2 ECDH 共享秘密派生密钥

  • Pbkdf2Sm3:RFC 8018 PBKDF2,PRF 为 HMAC-SM3,用于口令拉伸 【参数】(按算法适用,错配会被拒)

  • algorithm:HKDF / Sm3Kdf / Pbkdf2Sm3,默认 HKDF

  • hash_algorithm:仅 HKDF,默认 Sha256

  • input_in_hex:HKDF 的 IKM / Sm3Kdf 的共享秘密 Z,Hex(1B~16MB),与 password 二选一

  • password:仅 Pbkdf2Sm3,口令原文 utf-8(1~1024B)

  • salt_in_hex:HKDF/Pbkdf2Sm3 可选盐 Hex(≤256B)。HKDF 空=未提供(RFC 5869 补 HashLen 零);Pbkdf2Sm3 空=服务端生成 16B 随机盐并在响应回显

  • info_in_hex:仅 HKDF,可选上下文信息 Hex(≤256B)

  • iterations:仅 Pbkdf2Sm3,10000~4000000(默认 10000;受 8s 网关约束,eet CLI 上限为 16777216,互通测试建议取 ≤100 万区间)

  • derived_key_length:派生长度,16~1024B(默认 32;Pbkdf2Sm3 上限 256B) 【输出】derived_key_in_hex、derived_key_in_base64、salt_used_in_hex(实际使用的盐,Pbkdf2Sm3 未提供盐时回显服务端随机盐)、salt_generated、algorithm、hash_algorithm、iterations、derived_key_length、input_bytes。 【典型用途】ECDH 共享秘密到会话密钥的收口、口令到加密密钥的拉伸、多上下文密钥隔离(HKDF info)。

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": "key_derivation"
  }
}

Input Schema

NameRequiredDescriptionDefault
passwordNo密码(原始字符串,非编码格式;私钥工具为私钥加密密码,KDF Pbkdf2Sm3 为待拉伸口令)
algorithmNo密码算法名称(具体可选值因工具而异,见工具描述)HKDF
iterationsNoPBKDF2 迭代次数(整数;KDF Pbkdf2Sm3 范围 10000~4000000,默认 10000)
info_in_hexNoHKDF 上下文信息的十六进制字符串(可选,≤256B)
salt_in_hexNo盐的十六进制字符串(KDF,可选 ≤256B;Pbkdf2Sm3 留空则服务端生成 16B 随机盐并回显)
input_in_hexNo输入秘密的十六进制字符串(KDF:HKDF 的 IKM / Sm3Kdf 的共享秘密 Z,1B~16MB)
hash_algorithmNo哈希算法名称,可选值:Sha1 / Sha224 / Sha256 / Sha384 / Sha512(ECC 不支持 Sm3)Sha256
derived_key_lengthNoHKDF/KDF 派生密钥长度(整数,16~1024 字节;KDF Pbkdf2Sm3 上限 256)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.1/5.0
Behavior4/5

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

Annotations only declare it is a safe, non-open-world read. The description adds real behavioral context beyond them: per-algorithm parameter applicability, the Pbkdf2Sm3 server-side 16B random salt generation and echo, size bounds, iteration limits, and an explicit 8s gateway constraint on iterations. It does not discuss failure modes beyond 'mismatch rejected' or determinism/idempotency.

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

Conciseness4/5

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

The bracketed header plus algorithm/parameter/output sections make it scannable and front-loaded with purpose. It is somewhat long and repeats several schema-stated bounds and defaults (iterations range, key length range), but each block remains useful, not padding.

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

Completeness5/5

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

There is no output schema, yet the description lists all returned fields, including salt echo and salt_generated. Combined with per-algorithm applicability rules and limits, an agent has everything needed to call this 8-parameter tool correctly without guessing.

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 already 100%, so the baseline is 3. The description earns more by explaining cross-parameter semantics the schema only partly conveys: which parameters apply to which algorithm and the explicit 'input_in_hex vs password 二选一' mutual exclusivity, plus per-algorithm salt semantics.

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?

States a specific verb and resource: derive symmetric key material from a high-entropy secret or passphrase, with the three supported KDF families enumerated. It clearly separates itself from hashing/HMAC-type siblings by naming itself a KDF and framing the output as symmetric key material, though it never names an alternative tool for contrast.

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

Usage Guidelines4/5

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

The '典型用途' section gives concrete selection contexts: ECDH shared secret to session key, passphrase stretching, and multi-context key isolation via HKDF info. It also states that algorithm/parameter mismatches will be rejected, which guides correct choice. It lacks explicit when-not-to-use or named-alternative routing.

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.