Skip to main content
Glama

CipherHUB Cryptography Toolkit

ml_dsa_sign

Read-only

[pqc_signature] 使用 ML-DSA 私钥对消息签名(FIPS 204)。 【双模式】sign_mode 支持 RAW(默认)和 EXTERNAL_MU 两种模式。

  • RAW 模式:直接签名原始消息(liboqs,最大 256 字节)

  • EXTERNAL_MU 模式:先计算 mu = SHAKE-256(tr||M', 64),再通过 OpenSSL 3.5+ mu 模式签名(最大 2048 字节),与 AWS KMS ML-DSA EXTERNAL_MU 语义等价 【消息长度策略】

  • RAW:最大 256 字节,空消息合法

  • EXTERNAL_MU:最大 2048 字节,空消息合法

  • 256 且 <= 2048 字节:使用 EXTERNAL_MU

  • 2048 字节:拒绝 【算法】algorithm 支持 ML-DSA-44 / ML-DSA-65(默认)/ ML-DSA-87。 【参数】

  • private_key_in_hex:ml_dsa_keygen 返回的私钥 hex

  • public_key_spki_in_hex:EXTERNAL_MU 模式必填,ml_dsa_keygen 返回的公钥 hex(SPKI DER)

  • message_in_hex:待签消息 hex

  • context_in_hex:可选上下文 hex(最大 255 字节)

  • sign_mode:RAW 或 EXTERNAL_MU(默认 RAW) 【输出】signature_in_hex、signature_in_base64、algorithm、message_bytes、signature_bytes。

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

Input Schema

NameRequiredDescriptionDefault
algorithmNo密码算法名称(具体可选值因工具而异,见工具描述)ML-DSA-65
sign_modeNoML-DSA 签名模式,可选值:RAW(默认,直接签名原文)/ EXTERNAL_MU(先计算 mu 再签名,与 AWS KMS 语义等价)RAW
context_in_hexNoML-DSA 上下文的十六进制字符串(可选,最大 255 字节)
message_in_hexNo消息的十六进制字符串(空字符串表示空消息)
private_key_in_hexNoML-DSA 私钥的十六进制字符串(PKCS#8 DER 编码)
public_key_spki_in_hexNoML-DSA 公钥的十六进制字符串(SPKI DER 或裸公钥均可)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed8 schema fields changed
    • addedInput schema / properties / algorithm / description
      Added value: +"密码算法名称(具体可选值因工具而异,见工具描述)"
    • addedInput schema / properties / algorithm / enum
      Added value: +[
      +  "ML-DSA-44",
      +  "ML-DSA-65",
      +  "ML-DSA-87"
      +]
    • addedInput schema / properties / context_in_hex / description
      Added value: +"ML-DSA 上下文的十六进制字符串(可选,最大 255 字节)"
    • addedInput schema / properties / message_in_hex / description
      Added value: +"消息的十六进制字符串(空字符串表示空消息)"
    • addedInput schema / properties / private_key_in_hex / description
      Added value: +"ML-DSA 私钥的十六进制字符串(PKCS#8 DER 编码)"
    • addedInput schema / properties / public_key_spki_in_hex / description
      Added value: +"ML-DSA 公钥的十六进制字符串(SPKI DER 或裸公钥均可)"
    • addedInput schema / properties / sign_mode / description
      Added value: +"ML-DSA 签名模式,可选值:RAW(默认,直接签名原文)/ EXTERNAL_MU(先计算 mu 再签名,与 AWS KMS 语义等价)"
    • addedInput schema / properties / sign_mode / enum
      Added value: +[
      +  "RAW",
      +  "EXTERNAL_MU"
      +]
  2. Changed1 schema field changed
    • addedInput schema / properties / public_key_spki_in_hex
      Added value: +{
      +  "default": "",
      +  "title": "Public Key Spki In Hex",
      +  "type": "string"
      +}
  3. Changed1 schema field changed
    • addedInput schema / properties / sign_mode
      Added value: +{
      +  "default": "RAW",
      +  "title": "Sign Mode",
      +  "type": "string"
      +}
  4. First observed

TDQS

A4.4/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 the description is consistent with a non-mutating crypto operation. Beyond that, it discloses mode-specific size limits, the conditional requirement for public_key_spki_in_hex in EXTERNAL_MU, the 255-byte cap on context, and the KMS-equivalence semantics, which are genuinely additional facts. It omits failure behavior and any key-permission or error-format details, which keeps it below a 5.

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?

Section headers (双模式, 消息长度策略, 算法, 参数, 输出) front-load the decision-critical mode and length rules before the parameter list. There is moderate redundancy, since the 256/2048-byte limits and the RAW default are stated twice in different sections, which costs some tightness but does not obscure the content.

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?

No output schema exists, but the description enumerates the return fields (signature_in_hex, signature_in_base64, algorithm, message_bytes, signature_bytes), so the agent knows exactly what comes back. Combined with full mode, size, key-source, and parameter coverage, nothing needed to call this tool correctly is missing.

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 description coverage is 100%, so a 3 is the baseline, but the description adds real meaning: private_key_in_hex and public_key_spki_in_hex originate from ml_dsa_keygen, the public key is mandatory only in EXTERNAL_MU mode, context is capped at 255 bytes, and empty messages are legal. This cross-parameter dependency is not expressible in the flat schema and is the main added value.

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

Purpose5/5

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

States a specific verb and resource: sign a message with an ML-DSA private key per FIPS 204, with the exact algorithm variants named. The bracketed [pqc_signature] tag and the explicit signing semantics separate it cleanly from ml_dsa_verify and ml_dsa_compute_mu without needing to open the schema.

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?

Gives an explicit decision rule for choosing RAW versus EXTERNAL_MU based on message length (<=256, 256-2048, >2048 rejected) and spells out the when-not case (reject above 2048 bytes). It does not directly route to sibling tools such as ml_dsa_compute_mu or ml_dsa_keygen as prerequisites, so it stops just short of full alternative guidance.

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.