Skip to main content
Glama

CipherHUB Cryptography Toolkit

sm2_verify

[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

Input Schema

TableJSON 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 编码文本)

TDQS

A4.7/5.0
Behavior5/5

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

With no annotations provided, the description carries full responsibility and does an excellent job. It discloses that RAW mode triggers the server to internally compute e = SM3(ZA || M) before verification, while DIGEST mode performs no implicit SM3 and directly verifies the provided digest. It also specifies the fixed signature format and the boolean output, giving complete insight into the tool's behavior.

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 description is well-structured with clear labels for parameters, output, and workflow. While it is longer than a simple two-liner, the complexity of the two-mode behavior justifies the length. The core purpose is front-loaded in the first sentence, and the bullet-style formatting improves readability. Some redundancy with the schema exists, but it remains tightly organized.

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?

The tool has 5 parameters and no output schema, yet the description compensates fully. It states the output is 'verified (bool)' explicitly, covers all parameters with mode-specific explanations, and provides a complete workflow reference. For a cryptographic verification tool with this level of complexity, the description is exceptionally complete.

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?

Schema coverage is 100%, setting the baseline at 3. The description significantly enhances the schema by explaining the exact hex length requirement for DIGEST mode (64 hex characters for a 32-byte SM3 digest), the internal transformation e = SM3(ZA || M), and the critical constraint that sign_raw_data_mode must align with the signing mode. These details add substantial practical meaning beyond the parameter titles.

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 starts with 'SM2 公钥验签' (SM2 public key verification), clearly stating the tool's specific action and resource. It distinguishes itself from sibling tools like sm2_sign and sm2_encryption by mentioning the complete flow 'generate_sm2 → sm2_sign → sm2_verify', placing it definitively as the verification step.

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 description explains the two operating modes (RAW and DIGEST) and explicitly warns that sign_raw_data_mode must match the mode used during signing. It also notes that DIGEST mode is semantically consistent with KMS/ECC/RSA DIGEST mode, providing comparative guidance. The '完整流程' line gives a clear usage sequence, though it doesn't explicitly state when to avoid this tool in favor of alternatives.

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.

TDQS

A3.9/5.0
Disambiguation4/5

Most tools target a distinct algorithm+operation pair (e.g., rsa_sign vs sm2_sign vs ml_dsa_sign), and descriptions are detailed. However, block_cipher and stream_cipher both perform symmetric encryption, and ecc_key_exchange and hybrid_kex overlap as key exchange, requiring careful reading to distinguish.

Naming Consistency3/5

Naming is inconsistent across algorithm families: key generation mixes generate_ecc/generate_rsa with ml_dsa_keygen/ml_kem_keygen, and encryption mixes rsa_encryption/sm2_encryption with block_cipher/stream_cipher. Within each family (e.g., rsa_sign/rsa_verify, ml_dsa_sign/ml_dsa_verify), names are predictable, but the overall pattern is not uniform.

Tool Count2/5

32 tools is far above the typical 3-15 range for a well-scoped server. While every tool has a distinct function, the large surface makes the set heavy and harder to navigate, especially with multiple algorithm families and niche utilities.

Completeness5/5

The toolkit gives comprehensive coverage: key generation, encryption/decryption, signing/verification for RSA, ECC, SM2, ML-DSA, ML-KEM, plus symmetric ciphers, hashing, and key exchange. Full workflows are supported with no dead ends, and even helper tools for debugging are included.