Skip to main content
Glama

CipherHUB Cryptography Toolkit

sm2_encryption

[sm2] SM2 公钥加密。 【参数】

  • sm2_public_key_in_pem:PEM 格式公钥

  • plain_data_in_hex:明文 Hex 【输出】cipher_in_hex_with_format 字典,同时返回四种编码格式:

  • C1C3C2_ASN1:ASN.1 DER 编码(推荐,国标 GM/T 0009)

  • C1C2C3_ASN1:ASN.1 DER 旧格式

  • C1C3C2:原始拼接格式

  • C1C2C3:原始拼接旧格式 【注意】每次加密因随机 k 不同,密文不同,这是正常行为。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
plain_data_in_hexNo明文的十六进制字符串
sm2_public_key_in_pemNoSM2 公钥的 PEM 文本(含 BEGIN/END 头尾的 Base64 编码文本)

TDQS

A4.1/5.0
Behavior4/5

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

With no annotations provided, the description carries the full burden of disclosing behavior. It explains the output dictionary structure with four encoding formats and explicitly warns that ciphertexts vary due to a random k, which is a key behavioral trait. It does not mention potential input length limits or error cases, but the core behavior is well covered.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections for parameters, output, and notes. It is concise, front-loads the purpose, and every sentence provides useful information without redundancy.

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?

Given the absence of an output schema, the description thoroughly explains the return format (a dictionary with four encoding options) and highlights the non-deterministic nature of encryption. For a tool with two parameters and no output schema, this is complete enough for an agent to invoke and interpret results correctly.

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

Parameters3/5

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

The input schema already provides complete descriptions for both parameters (100% schema coverage). The description reiterates the parameter names and formats but adds little beyond the schema. It does not introduce constraints or additional semantics, so it meets the baseline for high schema coverage.

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 clearly states 'SM2 公钥加密' (SM2 public key encryption), specifying the verb (encrypt) and resource (SM2 public key). It effectively distinguishes this from sibling tools like sm2_decryption and sm2_sign.

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?

The description provides clear context that this tool performs SM2 public key encryption and explains the output formats. However, it does not explicitly mention when to use it versus alternatives (e.g., sm2_decryption) or any exclusions, so it lacks direct usage guidance relative to siblings.

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.