Skip to main content
Glama

CipherHUB Cryptography Toolkit

sm2_verify

Read-only

[sm2] SM2 公钥验签。 【参数】

  • sm2_public_key_in_pem:PEM 格式公钥

  • data_in_hex:待验签数据 Hex。 · RAW 模式(sign_raw_data_mode=True):消息原文 Hex,服务端走标准 SM2 流程,内部计算 e = SM3(ZA || M) 后验签。 · DIGEST 模式(sign_raw_data_mode=False):必须传 32 字节 SM3 摘要 e 的 Hex(64 个 hex 字符),服务端不再做任何隐式 SM3,直接对 e 做裸 SM2 验签,与 KMS / ECC / RSA 的 DIGEST 模式语义一致。

  • signature_in_hex:签名 Hex(必须为 RS_ASN1 格式)

  • signature_format:固定为 RS_ASN1

  • sign_raw_data_mode:必须与签名时一致;True=RAW,False=DIGEST 【输出】verified(bool,True=验签通过)。 【完整流程】generate_sm2 → sm2_sign → sm2_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": "sm2_verify"
  }
}

Input Schema

NameRequiredDescriptionDefault
data_in_hexNo数据的十六进制字符串。RAW 模式为消息原文 Hex,DIGEST 模式为哈希摘要 Hex
signature_formatNoSM2 签名编码格式,固定值:RS_ASN1(ASN.1 DER 编码)RS_ASN1
signature_in_hexNo签名的十六进制字符串
sign_raw_data_modeNoTrue=对原文签名(服务端内部先哈希),False=data_in_hex 已是哈希摘要的 Hex
sm2_public_key_in_pemNoSM2 公钥的 PEM 文本(含 BEGIN/END 头尾的 Base64 编码文本)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changed
    • addedInput schema / properties / data_in_hex / description
      Added value: +"数据的十六进制字符串。RAW 模式为消息原文 Hex,DIGEST 模式为哈希摘要 Hex"
    • addedInput schema / properties / sign_raw_data_mode / description
      Added value: +"True=对原文签名(服务端内部先哈希),False=data_in_hex 已是哈希摘要的 Hex"
    • addedInput schema / properties / signature_format / description
      Added value: +"SM2 签名编码格式,固定值:RS_ASN1(ASN.1 DER 编码)"
    • addedInput schema / properties / signature_format / enum
      Added value: +[
      +  "RS_ASN1"
      +]
    • addedInput schema / properties / signature_in_hex / description
      Added value: +"签名的十六进制字符串"
    • addedInput schema / properties / sm2_public_key_in_pem / description
      Added value: +"SM2 公钥的 PEM 文本(含 BEGIN/END 头尾的 Base64 编码文本)"
  2. 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 pure verification operation. Beyond that it discloses genuinely non-obvious behavior: in RAW mode the server internally computes e = SM3(ZA || M), in DIGEST mode it performs a bare SM2 verification with no implicit hashing, and the return value is a boolean 'verified'. The only gap is that it never says whether a failed verification returns false or raises an error.

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?

Bracketed sections (parameters / output / full flow) make it front-loaded and scannable, and the RAW vs DIGEST sub-bullets are the right granularity. Some of the parameter restatement overlaps with the schema descriptions, so it is slightly longer than strictly necessary, but nothing is wasted.

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?

For a 5-parameter, no-output-schema verification tool the definition covers input formats, the mode-consistency requirement, the boolean return, and pipeline placement — enough to call it correctly. It is only short on failure semantics and does not note that all parameters default to empty strings rather than being required.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Although schema coverage is already 100%, the description adds meaning the schema does not: DIGEST mode requires exactly 32 bytes / 64 hex characters, signature_in_hex must be RS_ASN1 encoded, and — critically — sign_raw_data_mode must match whatever was used at signing time or verification silently fails. That consistency constraint is the single most important thing an agent needs and it is stated explicitly.

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 first line states a specific verb and resource: SM2 public-key signature verification. Combined with the closing flow line (generate_sm2 → sm2_sign → sm2_verify), an agent can immediately place this tool relative to its signing sibling 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 '完整流程' line tells the agent exactly where this step belongs in the sign/verify pipeline, and the DIGEST-mode note ties its semantics to the KMS/ECC/RSA verify family, which is useful routing context. It stops short of explicit when-not-to-use guidance (e.g. that this is not for ECC/RSA keys or CMS/COSE envelopes), so a 4 rather than 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.