Skip to main content
Glama

CipherHUB Cryptography Toolkit

cms_signed_sign

[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 验。

Input Schema

TableJSON 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?

With no annotations, the description carries the full burden and does so richly: it discloses the exact authenticatedAttributes set (contentType, messageDigest, signingTime, SMIMECapabilities), the §5.4 untag/EXPLICIT SET OF re-encoding rule, attached vs detached payload behavior, input size bounds (1B–16MB), and concrete failure modes (signing failure error code for rejected algorithms, verify-side still accepts them).

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 【算法】【参数】【输出】【注意】 structure is front-loaded with purpose and scannable, and nearly every line carries information. It is dense and somewhat long, but there is little filler to cut.

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, so the description must explain returns, and it does: cms_in_hex, version, digest/signature algorithm OIDs, signer_sid, certificates_embedded, detached, and structure_tree. Combined with algorithm constraints, failure modes, and detached semantics, an agent has everything needed to invoke it correctly.

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; most parameter text is duplicated from the schema. However, the description adds one genuinely new constraint absent from the schema — the 1B–16MB input range for data_in_hex — plus the sid-locator rationale for embedding the certificate, lifting it slightly above baseline.

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 precise verb+resource: 'construct CMS SignedData signature message (RFC 5652 §5)', with the exact standard clause. An agent can distinguish this from siblings such as cms_signed_verify, cose_sign1_sign, and rsa_sign without opening any 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?

The 【注意】 section gives real selection constraints: Ed25519 and SHA1 signing are rejected by the upstream builder, and RSA-PSS construction is not exposed (PSS artifacts must be verified via cms_signed_verify). This implicitly tells the agent when not to use the tool, but there is no explicit 'use this when you need a CMS structure rather than a bare signature' comparison against rsa_sign/cose_sign1_sign.

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.