Skip to main content
Glama

CipherHUB Cryptography Toolkit

cose_sign1_sign

Read-only

[cose_sign1] 构造并签名 COSE_Sign1 消息(RFC 9052 §4.2,算法 RFC 9053)。 【算法】ES256(-7, P-256+SHA-256) / ES384(-35, P-384+SHA-384) / ES512(-36, P-521+SHA-512) / EdDSA(-8, Ed25519)。ES 系签名为裸 r||s (坐标左补零到曲线宽度,ES512 坐标 66 字节、r||s 共 132 字节)。 【参数】

  • algorithm:ES256 / ES384 / ES512 / EdDSA

  • ecc_private_key_in_pem:EC 或 Ed25519 私钥 PEM(须与算法曲线匹配)

  • ecc_private_key_password:私钥口令(未加密则留空)

  • payload_in_hex:待签 payload(1B~256KB)

  • external_aad_in_hex:外部 AAD(可选,默认空串) 【输出】cose_sign1_in_hex(完整 COSE_Sign1)、protected_in_hex、 sig_structure_in_hex(Sig_structure 待签字节,RFC 9052 §4.4,可直送 openssl dgst 交叉)、signature_raw_in_hex(裸 r||s)、 signature_der_in_hex / r_in_hex / s_in_hex(EdDSA 无此形态)、structure_tree。 【注意】签名真正覆盖的是 Sig_structure = ["Signature1", protected, external_aad, payload] 的规范编码,不是 payload 本身。

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

Input Schema

NameRequiredDescriptionDefault
detachedNoTrue 时载荷带外(COSE payload 置 null / CMS eContent 缺省),验签必须提供外部内容;默认 False
algorithmNo密码算法名称(具体可选值因工具而异,见工具描述)ES384
payload_in_hexNoCOSE Sign1 待签 payload 的十六进制字符串(1B~256KB)
external_aad_in_hexNo外部 AAD 的十六进制字符串(可选;参与 Sig_structure 但不出现在消息里)
ecc_private_key_in_pemNoECC 私钥的 PEM 文本(含 BEGIN/END 头尾的 Base64 编码文本)
ecc_private_key_passwordNoECC 私钥的加密密码(原始字符串,非编码格式)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4/5.0
Behavior5/5

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

Annotations only declare readOnly/openWorld, so the description carries the real burden and does it well: it discloses that the signature covers the canonical Sig_structure rather than the payload itself, gives exact ES signature encodings (bare r||s, ES512 coordinates 66 bytes, 132 bytes total), notes EdDSA has no DER/r/s forms, and states the payload size bound. This is the kind of detail that prevents silent verification failures downstream.

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?

Front-loaded with the operation, then cleanly partitioned into 【算法】/【参数】/【输出】/【注意】 blocks, which makes it scannable despite its length. Nearly every line carries information; the only waste is the mismatch between the parameter list and the actual schema (detached missing).

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?

There is no output schema, and the description compensates fully by enumerating every returned field (cose_sign1_in_hex, protected_in_hex, sig_structure_in_hex, signature_raw/der/r/s, structure_tree) and their relationships. The only incompleteness is the undocumented `detached` parameter, which affects whether the payload is in-band.

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 100%, so the baseline is 3; the description goes beyond by explaining curve/algorithm coupling for the PEM key, the empty-string default for external_aad, and why AAD participates in Sig_structure while never appearing in the message. The one gap is that the description's 【参数】 block omits the `detached` flag entirely, leaving that behavior to the schema alone.

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: "构造并签名 COSE_Sign1 消息", pinned to RFC 9052 §4.2 and RFC 9053, so the agent knows exactly what artifact comes out (a COSE_Sign1). It never explicitly contrasts itself with cms_signed_sign or ecc_key_sign, so sibling differentiation is left to the tool name.

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?

Practical calling guidance is present (key curve must match the algorithm, password left blank when the key is unencrypted, payload 1B~256KB), but there is no explicit when-to-use / when-not-to-use statement and no mention of cose_sign1_verify as the natural follow-up or cms_signed_sign as the CMS alternative. Usage is implied by the operation, not spelled out.

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.