Skip to main content
Glama

CipherHUB Cryptography Toolkit

cms_signed_sign

Read-only

[cms_signed] 构造 CMS SignedData 签名消息(RFC 5652 §5)。 【算法】RSA PKCS#1 v1.5 或 ECDSA × SHA224/256/384/512; authenticatedAttributes 自动携带 contentType + messageDigest + signingTime + SMIMECapabilities,签名按 §5.4 计算在 signedAttrs 的 EXPLICIT SET OF(0x31)DER 重编码上(untag 规则)。 【参数】

  • signer_certificate_in_pem:签名者证书 PEM(嵌入 certificates 集, 验签方可按 sid 定位)

  • signer_private_key_in_pem / signer_private_key_password:签名 私钥与口令(未加密留空)

  • hash_algorithm:Sha256(默认)/ Sha384 / Sha512 / Sha224 / Sha1

  • detached:True 时 eContent 缺省(§5.2,载荷带外,验签必填 外部内容);默认 False(attached,内容嵌消息)

  • data_in_hex:待签原文(1B~16MB) 【输出】cms_in_hex(DER 定长)、version(=1)、digest/signature 算法与 OID、signer_sid、certificates_embedded、detached、 structure_tree(ASN.1 TLV 拆解树)。 【注意】Ed25519 与 SHA1 签名被上游 PKCS7SignatureBuilder 拒绝 (add_signer 只收 RSA/EC × SHA224-512),返回签名失败错误码, 验签侧照常支持;RSA-PSS 构建未暴露——openssl cms -sign -keyopt rsa_padding_mode:pss 的产物可用 cms_signed_verify 验。

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

Input Schema

NameRequiredDescriptionDefault
detachedNoTrue 时载荷带外(COSE payload 置 null / CMS eContent 缺省),验签必须提供外部内容;默认 False
data_in_hexNo数据的十六进制字符串。RAW 模式为消息原文 Hex,DIGEST 模式为哈希摘要 Hex
hash_algorithmNo哈希算法名称,可选值:Sha1 / Sha224 / Sha256 / Sha384 / Sha512(ECC 不支持 Sm3)Sha256
signer_certificate_in_pemNo签名者证书的 PEM 文本(嵌入 certificates 集,验签方可按 sid 定位)
signer_private_key_in_pemNo签名者私钥的 PEM 文本(含 BEGIN/END 头尾)
signer_private_key_passwordNo签名者私钥的加密密码(原始字符串,未加密则留空)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.6/5.0
Behavior5/5

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

Annotations only declare readOnlyHint/openWorldHint, so the description carries the real burden and does it well: it specifies that authenticatedAttributes automatically include contentType, messageDigest, signingTime and SMIMECapabilities, and that the signature is computed over the EXPLICIT SET OF (0x31) DER re-encoding per §5.4. It also discloses the payload size window (1B–16MB) and that unsupported algorithm requests return a signature-failure error code, which is exactly the kind of failure-mode context annotations cannot provide.

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?

Content is front-loaded into bracketed sections (algorithm, parameters, output, caveats) that let an agent skim to what it needs, and no sentence is pure filler. It is dense and longer than typical, but the length is justified by the number of algorithms and edge cases covered.

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 enumerates the return fields (cms_in_hex, version=1, digest/signature algorithm OIDs, signer_sid, certificates_embedded, detached, structure_tree). Combined with the algorithm-support caveats and error behavior, nothing an agent needs to invoke this tool correctly appears to be 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 coverage is 100%, so the baseline is 3, but the description adds real meaning beyond the schema: it states data_in_hex is bounded to 1B–16MB, that the private key password should be left empty when the key is unencrypted, and that the signer certificate is embedded in the certificates set so verifiers can locate it by sid. These are operational constraints the schema's terse field descriptions do not fully convey.

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?

The description opens with a specific verb and resource: '构造 CMS SignedData 签名消息(RFC 5652 §5)', naming the exact standard section. This immediately separates it from cms_signed_verify (which validates) and from cose_sign1_sign (a different container format), so an agent can select it without opening 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?

It gives concrete selection context: detached=True means out-of-band payload and verification must supply external content, while the default attached mode embeds content. It also implicitly excludes unsupported paths by stating Ed25519 and SHA1 signing are rejected upstream and RSA-PSS is not exposed, so an agent knows when to look elsewhere. It does not explicitly name a sibling tool to use instead, which keeps it from a 5.

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.