本文档为 easy_encryption_tool 的完整 CLI 命令参考,适用于开发者文档、QA 测试用例生成及 CLI 可用性参考。

QQ_1771644351334

QQ_1771645182430

QQ_1771644334022


全局输出选项(适用于所有命令)

选项说明
--json单行 JSON 输出,便于管道解析
--pretty-json显式指定彩色 pretty JSON(默认)
--raw仅输出主结果值,便于复制/管道

QQ_1771644374719

QQ_1771644388577

QQ_1771644402264


一、对称加密

1.1 AES 命令

PURPOSE

对数据进行 AES-256 对称加密或解密。支持 CBC 和 GCM 两种模式。CBC 使用 PKCS#7 填充;GCM 默认无填充(CipherHUB 兼容),可选 --gcm-pad 启用 PKCS#7 填充。

BASIC USAGE

1
easy_encryption_tool aes -A encrypt -i "hello"

QQ_1771644547746

QQ_1771644524380

VALID PARAMETER COMBINATIONS

组合示例
文本加密(CBC 默认)easy_encryption_tool aes -m cbc -A encrypt -i "hello"
文本加密(GCM)easy_encryption_tool aes -m gcm -A encrypt -i "hello"
文本解密(base64 输入)easy_encryption_tool aes -A decrypt -i "<cipher_b64>" -e
文件加密easy_encryption_tool aes -A encrypt -i /path/to/file -f -o /path/to/out
文件解密easy_encryption_tool aes -A decrypt -i /path/to/cipher -f -o /path/to/plain
随机 key/iveasy_encryption_tool aes -A encrypt -i "hello" -r
自定义 key/iveasy_encryption_tool aes -k "01234567890123456789012345678901" -v "0123456789012345" -A encrypt -i "hello"
GCM AADeasy_encryption_tool aes -m gcm -A encrypt -i "hello" --aad "custom AAD"
GCM 填充easy_encryption_tool aes -m gcm -A encrypt -i "hello" --gcm-pad
JSON 输出easy_encryption_tool aes -A encrypt -i "hello" --json
Raw 输出easy_encryption_tool aes -A encrypt -i "hello" --raw
提高输入限制easy_encryption_tool aes -A encrypt -i "..." -l 10
禁止覆盖输出文件easy_encryption_tool aes -A encrypt -i file -f -o out --no-force

ADVANCED USAGE SCENARIOS

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# 管道输入
echo "hello" | xargs -I {} easy_encryption_tool aes -A encrypt -i {}

# 输出重定向
easy_encryption_tool aes -A encrypt -i "hello" --raw > cipher.txt

# 结合 JSON 模式解析
CIPHER=$(easy_encryption_tool aes -A encrypt -i "hello" --json | jq -r '.result.cipher')

# 解密并管道到下一命令
easy_encryption_tool aes -A decrypt -i "$CIPHER" -e --raw | xxd

QQ_1771644467570

INVALID INPUT EXAMPLES

命令原因预期错误
easy_encryption_tool aes -A encrypt缺少 -iError: Missing option '-i' / '--input-data'
easy_encryption_tool aes -A decrypt -i "hello"解密需 base64 或文件,未加 -edecrypt requires base64 cipher or file; use -e for base64 input
easy_encryption_tool aes -i file -f -e-e-f 互斥cannot use -e and -f together
easy_encryption_tool aes -i file -f文件输入需 -ooutput file is required when input is a file
easy_encryption_tool aes -A encrypt -i "..." -e 且输入非合法 base64非法 base64invalid b64 encoded data
easy_encryption_tool aes -m invalid -A encrypt -i "x"无效 modeClick 选项错误
easy_encryption_tool aes -A encrypt -i ""空输入no input data, it is required

MUTUALLY EXCLUSIVE PARAMETER CASES

  • -e-f:不能同时指定。-e 表示输入为 base64;-f 表示输入为文件路径。
  • -r-k/-v:使用 -r 时,-k/-v 会被覆盖为随机值。

EDGE CASES

场景命令预期行为
空输入easy_encryption_tool aes -A encrypt -i ""错误:no input data
超长输入`easy_encryption_tool aes -A encrypt -i “$(head -c 2M /dev/zerotr ‘\0’ ‘a’)"`
Unicodeeasy_encryption_tool aes -A encrypt -i "你好世界"正常 UTF-8 编码
含换行easy_encryption_tool aes -A encrypt -i "line1\nline2"正常
二进制(base64)`easy_encryption_tool aes -A encrypt -i “$(echo -n ‘\x00\x01’base64)” -e`

OUTPUT STRUCTURE EXPECTATION

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
{
  "metadata": {
    "operation": "encrypt",
    "algorithm": "aes-cbc-256",
    "encoding": "base64",
    "input": { "type": "text", "size": 5 },
    "parameters": { "mode": "cbc", "iv_size": 16 }
  },
  "result": { "cipher": "VcyOES9/0YifXvnZKo8c4g==" },
  "runtime": {
    "request_id": "uuid",
    "timestamp": "ISO8601",
    "duration_ms": 1.4,
    "host": "...",
    "version": "v2.x.x"
  }
}

1.2 SM4 命令

PURPOSE

国密 SM4 对称加密/解密。支持 CBC 和 GCM 模式。需安装 easy_gmssl

BASIC USAGE

1
easy_encryption_tool sm4 -A encrypt -i "hello"

QQ_1771644576531

QQ_1771644503511

VALID PARAMETER COMBINATIONS

组合示例
CBC 加密easy_encryption_tool sm4 -m cbc -A encrypt -i "hello"
GCM 加密easy_encryption_tool sm4 -m gcm -A encrypt -i "hello"
解密easy_encryption_tool sm4 -A decrypt -i "<cipher>" -e
文件easy_encryption_tool sm4 -A encrypt -i file -f -o out
随机 key/iveasy_encryption_tool sm4 -A encrypt -i "hello" -r
GCM AADeasy_encryption_tool sm4 -m gcm -A encrypt -i "hello" --aad "AAD"
--gcm-padeasy_encryption_tool sm4 -m gcm -A encrypt -i "hello" --gcm-pad

INVALID INPUT EXAMPLES

命令原因预期错误
未安装 easy_gmssl任意 sm4 命令提示安装 easy_gmssl
-e-f 同时sm4 -i x -f -e互斥错误
解密无 base64sm4 -A decrypt -i "plain"decrypt requires base64 cipher or file

MUTUALLY EXCLUSIVE PARAMETER CASES

  • -e-f:互斥。
  • -r-k/-v-r 时 key/iv 由工具生成。

EDGE CASES

场景命令预期
空输入sm4 -A encrypt -i ""no input data
CBC 密文文件大小非 16 倍数sm4 -A decrypt -i bad.bin -f -o outinvalid cipher file size

OUTPUT STRUCTURE EXPECTATION

1
2
3
4
5
{
  "metadata": { "operation": "encrypt", "algorithm": "sm4-cbc", "parameters": { "mode": "cbc" } },
  "result": { "cipher": "..." },
  "runtime": { "request_id": "...", "timestamp": "...", "duration_ms": 0.1, "host": "...", "version": "..." }
}

1.3 ZUC 命令

PURPOSE

国密 ZUC 流密码加密/解密。key 和 iv 均为 16 字节。需 easy_gmssl

BASIC USAGE

1
easy_encryption_tool zuc -A encrypt -i "hello"

QQ_1771644613495

VALID PARAMETER COMBINATIONS

组合示例
加密easy_encryption_tool zuc -A encrypt -i "hello"
解密easy_encryption_tool zuc -A decrypt -i "<cipher>" -e
文件easy_encryption_tool zuc -A encrypt -i file -f -o out
随机 key/iveasy_encryption_tool zuc -A encrypt -i "hello" -r
自定义 key/iveasy_encryption_tool zuc -k "0123456789012345" -v "0123456789012345" -A encrypt -i "x"

ADVANCED USAGE SCENARIOS

1
2
3
4
5
6
# 管道 + raw 输出
echo "secret" | xargs -I {} easy_encryption_tool zuc -A encrypt -i {} --raw | base64 -d | xxd

# 加密后解密验证
CIPHER=$(easy_encryption_tool zuc -A encrypt -i "data" --raw)
easy_encryption_tool zuc -A decrypt -i "$CIPHER" -e --raw

INVALID INPUT EXAMPLES

命令原因预期错误
未安装 easy_gmssl任意 zuc 命令提示安装
解密无 base64zuc -A decrypt -i "plain"decrypt requires base64 cipher or file
文件输入无 -ozuc -i file -foutput file is required for file input

MUTUALLY EXCLUSIVE PARAMETER CASES

  • -e-f:互斥。
  • -r-k/-v-r 时 key/iv 由工具生成。

EDGE CASES

场景命令预期
空输入zuc -A encrypt -i ""no input data
流密码密文长度=明文长度正常无填充,密文与明文等长

OUTPUT STRUCTURE EXPECTATION

1
2
3
4
5
{
  "metadata": { "operation": "encrypt", "algorithm": "zuc", "parameters": { "key_size": 16, "iv_size": 16 } },
  "result": { "cipher": "..." },
  "runtime": { "request_id": "...", "timestamp": "...", "duration_ms": 0.05, "host": "...", "version": "..." }
}

二、哈希

2.1 hash 命令

PURPOSE

计算消息摘要。支持 SHA256、SHA384、SHA512、SM3(需 easy_gmssl)。

BASIC USAGE

1
easy_encryption_tool hash -i "hello"

QQ_1771644687282

QQ_1771644665678

VALID PARAMETER COMBINATIONS

组合示例
SHA256(默认)easy_encryption_tool hash -i "hello"
SHA384easy_encryption_tool hash -i "hello" -a sha384
SHA512easy_encryption_tool hash -i "hello" -a sha512
SM3easy_encryption_tool hash -i "hello" -a sm3
Base64 输入easy_encryption_tool hash -i "<b64>" -e
文件输入easy_encryption_tool hash -i /path/to/file -f
JSON/Raweasy_encryption_tool hash -i "hello" --json / --raw
stdin 间接输入echo "hello" | xargs -I {} easy_encryption_tool hash -i {}

ADVANCED USAGE SCENARIOS

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# 管道 + raw 输出
echo "hello" | xargs -I {} easy_encryption_tool hash -i {} --raw

# 文件哈希并解析 JSON
easy_encryption_tool hash -i /path/to/file -f --json | jq -r '.result.digest'

# 多算法比对
for alg in sha256 sha384 sha512; do
  easy_encryption_tool hash -i "data" -a $alg --raw
done

INVALID INPUT EXAMPLES

命令原因预期错误
-e-f 同时hash -i x -e -f互斥错误
SM3 未安装 gmsslhash -i "x" -a sm3提示安装 easy_gmssl
非法 base64hash -i "!!!" -einvalid b64 encoded data
无效算法hash -i "x" -a md5Click 选项错误

MUTUALLY EXCLUSIVE PARAMETER CASES

  • -e-f:不能同时使用。

EDGE CASES

场景命令预期
空字符串hash -i ""正常(空摘要)
Unicodehash -i "中文"正常 UTF-8
大文件hash -i large.bin -f流式计算

OUTPUT STRUCTURE EXPECTATION

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
{
  "metadata": {
    "operation": "hash",
    "algorithm": "sha256",
    "encoding": "hex",
    "input": { "type": "text", "size": 5 },
    "parameters": { "digest_size": 32 }
  },
  "result": { "digest": "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824" },
  "runtime": { "request_id": "...", "timestamp": "...", "duration_ms": 0.15, "host": "...", "version": "..." }
}

三、HMAC

3.1 hmac 命令

PURPOSE

计算 HMAC 消息认证码。支持 sha224、sha256、sha384、sha512、sha3_224、sha3_256、sha3_384、sha3_512、sm3。

BASIC USAGE

1
easy_encryption_tool hmac -i "hello" -k "01234567890123456789012345678901"

QQ_1771644734752

QQ_1771644719751

VALID PARAMETER COMBINATIONS

组合示例
SHA256(默认)easy_encryption_tool hmac -i "hello"
SHA384easy_encryption_tool hmac -i "hello" -a sha384
SM3easy_encryption_tool hmac -i "hello" -a sm3 -k "01234567890123456789012345678901"
随机 keyeasy_encryption_tool hmac -i "hello" -r
Base64 输入easy_encryption_tool hmac -i "<b64>" -e
文件输入easy_encryption_tool hmac -i /path/to/file -f
stdin 间接echo "data" | xargs -I {} easy_encryption_tool hmac -i {} -k "01234567890123456789012345678901"

ADVANCED USAGE SCENARIOS

1
2
3
4
5
# CipherHUB 兼容 HMAC(默认 key 32 字节)
easy_encryption_tool hmac -i "你好,密码学人 CipherHUB!" -a sha256 -k 01234567890123456789012345678901 --raw

# 管道 + JSON 解析
HMAC=$(echo "msg" | xargs -I {} easy_encryption_tool hmac -i {} --json | jq -r '.result.hmac')

INVALID INPUT EXAMPLES

命令原因预期错误
SM3 key 长度不符hmac -a sm3 -k "short" -i "x"SM3 HMAC key length must be X-Y bytes
-e-f 同时hmac -i x -e -f互斥错误

MUTUALLY EXCLUSIVE PARAMETER CASES

  • -e-f:互斥。
  • -r-k-r 时 key 由工具生成,-k 被忽略。

EDGE CASES

场景命令预期
空消息hmac -i "" -k "01234567890123456789012345678901"正常(空消息的 HMAC)
Unicodehmac -i "中文" -k "01234567890123456789012345678901"正常 UTF-8

OUTPUT STRUCTURE EXPECTATION

1
2
3
4
5
{
  "metadata": { "operation": "hmac", "algorithm": "sha256", "encoding": "hex", "parameters": { "digest_size": 32 } },
  "result": { "hmac": "fa051b654b1ab3e6902f3898e4b1f6b9a23787c52fb6f50408d46efe5864f7a1" },
  "runtime": { "request_id": "...", "timestamp": "...", "duration_ms": 0.05, "host": "...", "version": "..." }
}

四、非对称加密

4.1 RSA 命令组

rsa generate

PURPOSE:生成 RSA 密钥对。

BASIC USAGE

1
easy_encryption_tool rsa generate -f demo

QQ_1771644809472

VALID COMBINATIONS

组合示例
2048 位(默认)easy_encryption_tool rsa generate -f demo -p 1234567890
3072/4096 位easy_encryption_tool rsa generate -s 3072 -f demo -p 1234567890
带密码easy_encryption_tool rsa generate -f demo -p 1234567890
随机密码easy_encryption_tool rsa generate -f demo -r
DER 编码easy_encryption_tool rsa generate -f demo -E der -p 1234567890

INVALID-p-r 同时使用(逻辑冲突,应只用其一)。

OUTPUTresult.public_file, result.private_file,可选 result.password


rsa encrypt

PURPOSE:使用公钥加密。

BASIC USAGE

1
easy_encryption_tool rsa encrypt -f demo_rsa_public.pem -i "hello"

VALID COMBINATIONS

组合示例
OAEP+SHA256(默认)easy_encryption_tool rsa encrypt -f pub.pem -i "hello"
OAEP+SHA384easy_encryption_tool rsa encrypt -f pub.pem -i "hello" -m oaep -a sha384
PKCS#1 v1.5easy_encryption_tool rsa encrypt -f pub.pem -i "hello" -m pkcs1v15
Base64 输入easy_encryption_tool rsa encrypt -f pub.pem -i "<b64>" -e

INVALID

命令原因预期错误
明文超长2048 RSA+OAEP+SHA256 明文 >190 字节plain size: X exceeds max allowed: 190 bytes
非法 base64-e 且输入非法invalid b64 encoded data

rsa decrypt

PURPOSE:使用私钥解密。

BASIC USAGE

1
easy_encryption_tool rsa decrypt -f demo_rsa_private.pem -i "<cipher_b64>" -m oaep -a sha256

VALID COMBINATIONS:与 encrypt 的 mode/hash 必须一致;私钥有密码时加 -p

INVALID:密文/模式/哈希不匹配 → decrypt failed (invalid ciphertext or key/mode mismatch)


rsa sign

PURPOSE:使用私钥签名。

BASIC USAGE

1
easy_encryption_tool rsa sign -f demo_rsa_private.pem -i "hello" -m pss -a sha256

VALID COMBINATIONS

组合示例
PSS+SHA256(默认)easy_encryption_tool rsa sign -f pri.pem -i "hello"
PKCS#1 v1.5easy_encryption_tool rsa sign -f pri.pem -i "hello" -m pkcs1v15 -a sha256
摘要输入easy_encryption_tool rsa sign -f pri.pem -i "<32_byte_sha256_b64>" -e -d -a sha256

INVALID-d 时输入长度必须等于 -a 对应摘要长度,否则 input-is-digest mode requires X bytes


rsa verify

PURPOSE:使用公钥验签。

BASIC USAGE

1
easy_encryption_tool rsa verify -f demo_rsa_public.pem -i "hello" -s "<signature_b64>" -m pss -a sha256

INVALID:签名为空 → signature cannot be empty;验签失败 → InvalidSignature!


五、ECC 命令组

5.1 ecc generate

PURPOSE:生成 ECC 密钥对。支持 secp256r1、secp384r1、secp521r1、secp256k1、ed25519、x25519。

BASIC USAGE

1
easy_encryption_tool ecc generate -c secp256r1 -f demo

VALID COMBINATIONS

曲线用途示例
secp256r1/384r1/521r1ECDSA + ECDHecc generate -c secp256r1 -f demo
secp256k1ECDSA + ECDHecc generate -c secp256k1 -f demo
ed25519仅签名ecc generate -c ed25519 -f demo
x25519仅 ECDHecc generate -c x25519 -f demo
带密码ecc generate -c secp256r1 -f demo -p pass
随机密码ecc generate -c secp256r1 -f demo -r

5.2 ecc ecdh

PURPOSE:ECDH 密钥协商,派生共享密钥。不支持 Ed25519。

BASIC USAGE

1
easy_encryption_tool ecc ecdh -k alice_private.pem -b bob_public.pem

VALID COMBINATIONS

组合示例
基本ecc ecdh -k alice_pri.pem -b bob_pub.pem
可选校验己方公钥ecc ecdh -k alice_pri.pem -a alice_pub.pem -b bob_pub.pem
自定义 HKDF 参数ecc ecdh -k a.pem -b b.pem -l 32 -H sha256 -s "salt" -c "context"
私钥密码ecc ecdh -k a.pem -b b.pem -p password

INVALID

命令原因预期错误
Ed25519 私钥Ed25519 仅签名ed25519 keys are for signing/verification only
X25519 与 secp 混用曲线类型不匹配Key type mismatch
同一密钥对己方私钥与对方公钥同对Same key pair detected

5.3 ecc sign

PURPOSE:ECDSA 或 Ed25519 签名。

BASIC USAGE

1
easy_encryption_tool ecc sign -f demo_ecc_private.pem -i "hello" -a sha256

VALID COMBINATIONS

曲线类型示例
secp* + SHA256ecc sign -f pri.pem -i "hello" -a sha256
Ed25519(忽略 -a)ecc sign -f ed25519_pri.pem -i "hello"
摘要输入ecc sign -f pri.pem -i "<digest_b64>" -e -d -a sha256

INVALID:Ed25519 使用 -dEd25519 does not support -d/--input-is-digest;X25519 签名 → x25519 keys are for key exchange only


5.4 ecc verify

PURPOSE:验证 ECDSA 或 Ed25519 签名。

BASIC USAGE

1
easy_encryption_tool ecc verify -f demo_ecc_public.pem -i "hello" -s "<signature_b64>" -a sha256

INVALID:X25519 公钥验签 → x25519 keys are for key exchange only;Ed25519 使用 -d → 不支持。


六、SM2 命令组

6.1 sm2 generate

PURPOSE:生成 SM2 密钥对。私钥必须设置 1–32 字节密码。

BASIC USAGE

1
easy_encryption_tool sm2 generate -f demo -p 12345678

VALID COMBINATIONS

组合示例
固定密码sm2 generate -f demo -p 12345678
随机密码sm2 generate -f demo -r

INVALID:无密码或密码超 32 字节 → SM2 private key password must be 1-32 bytes


6.2 sm2 encrypt

PURPOSE:SM2 公钥加密。

BASIC USAGE

1
easy_encryption_tool sm2 encrypt -f demo_sm2_public.pem -i "hello"

VALID COMBINATIONS

密文格式示例
C1C3C2_ASN1(默认)sm2 encrypt -f pub.pem -i "hello"
C1C3C2/C1C2C3_ASN1/C1C2C3sm2 encrypt -f pub.pem -i "hello" -m C1C3C2
hex 输出sm2 encrypt -f pub.pem -i "hello" -o hex

6.3 sm2 decrypt

PURPOSE:SM2 私钥解密。必须提供 -p 密码。

BASIC USAGE

1
easy_encryption_tool sm2 decrypt -f demo_sm2_private.pem -i "<cipher>" -p 12345678

VALID COMBINATIONS:base64(默认)或 -x hex 输入;-m 需与加密一致。


6.4 sm2 sign

PURPOSE:SM2 签名。支持原始数据或 SM3 摘要。

BASIC USAGE

1
easy_encryption_tool sm2 sign -f demo_sm2_private.pem -i "hello" -p 12345678

VALID COMBINATIONS

组合示例
原始数据sm2 sign -f pri.pem -i "hello" -p pass
SM3 摘要sm2 sign -f pri.pem -i "<32_byte_b64>" -e -d -p pass
RS 格式sm2 sign -f pri.pem -i "hello" -p pass -m RS
自定义 signer-idsm2 sign -f pri.pem -i "hello" -p pass --signer-id "custom"

INVALID-d 时输入非 32 字节 → input-is-digest mode requires SM3 digest (32 bytes)


6.5 sm2 verify

PURPOSE:SM2 验签。

BASIC USAGE

1
easy_encryption_tool sm2 verify -f demo_sm2_public.pem -i "hello" -s "<sig_b64>" -p 12345678

VALID COMBINATIONS--sig-hex 表示签名为 hex;-d 表示输入为 SM3 摘要。


七、随机数生成

7.1 random-str 命令

PURPOSE

使用 CSPRNG 生成指定长度的随机字符串(字母、数字、特殊字符)。

BASIC USAGE

1
easy_encryption_tool random-str -l 32

VALID PARAMETER COMBINATIONS

组合示例
默认 32 字符easy_encryption_tool random-str
指定长度easy_encryption_tool random-str -l 16
输出到文件easy_encryption_tool random-str -l 64 -o out.txt
禁止覆盖easy_encryption_tool random-str -l 32 -o out.txt --no-force
JSON/Raweasy_encryption_tool random-str -l 16 --json / --raw

ADVANCED USAGE SCENARIOS

1
2
3
4
5
6
7
8
# 生成 AES key(32 字节 = 32 字符)
easy_encryption_tool random-str -l 32 --raw

# 生成并写入文件,用于后续加密
easy_encryption_tool random-str -l 64 -o /tmp/random.bin --raw

# 管道到其他命令
easy_encryption_tool random-str -l 16 --raw | xxd

INVALID INPUT EXAMPLES

命令原因预期错误
random-str -l 0长度至少 1Click IntRange 错误
random-str -l -1负数Click 错误
输出文件不可写random-str -o /nonexistent/path/filetry write to ... failed
已存在文件 + --no-forcerandom-str -o existing.txt --no-force写入失败或跳过

MUTUALLY EXCLUSIVE PARAMETER CASES

  • 无互斥参数。-o 与默认 stdout 输出二选一(有 -o 时写文件,否则输出到 stdout)。

EDGE CASES

场景命令预期
最小长度random-str -l 1输出 1 个字符
超长输出random-str -l 1000000分块生成,可能较慢

OUTPUT STRUCTURE EXPECTATION

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
{
  "metadata": {
    "operation": "random",
    "algorithm": "cspng",
    "encoding": "utf-8",
    "input": { "type": "stdin", "size": 0 },
    "parameters": { "length": 16 }
  },
  "result": { "value": "QHeIart6o5J&n60Q" },
  "runtime": { "request_id": "...", "timestamp": "...", "duration_ms": 0.05, "host": "...", "version": "..." }
}

八、证书解析

8.1 cert-parse 命令

PURPOSE

解析 X.509 证书(PEM/DER)或国密 SM2 证书(PEM),并可选验证签名。注意:本命令输出为纯文本,不遵循 CipherHUB JSON schema,且不支持 --json/--raw

BASIC USAGE

1
easy_encryption_tool cert-parse -f /path/to/cert.pem

VALID PARAMETER COMBINATIONS

组合示例
PEM(默认)easy_encryption_tool cert-parse -f cert.pem
DEReasy_encryption_tool cert-parse -f cert.der -e der
国密 SM2easy_encryption_tool cert-parse -f gm_cert.pem -g
详细输出easy_encryption_tool cert-parse -f cert.pem -v

INVALID INPUT EXAMPLES

命令原因预期错误
国密证书用 DERcert-parse -f x.pem -g -e derGM cert parse supports PEM only
证书文件 >10KB大文件cert file ... size ... Bytes, too large (max 10KB)
无效证书格式损坏或非证书文件loading cert file ... failed

九、主入口命令

9.1 install-completion

PURPOSE:安装 Shell 自动补全(bash/zsh/fish)。

BASIC USAGE

1
easy_encryption_tool install-completion --shell zsh

VALID-s bash|zsh|fish-p /path/to/script 输出到文件。


9.2 show-version(version)

PURPOSE:显示工具版本。

BASIC USAGE

1
easy_encryption_tool --version

十、CipherHUB 默认参数速查

参数默认值
AES key01234567890123456789012345678901 (32 字节)
AES/SM4 IV0123456789012345 (16 字节)
GCM nonce012345678901234567890123 (12 字节)
AAD密码学人 CipherHUB 默认 AAD 数据
HMAC key01234567890123456789012345678901 (32 字节)
SM2 signer ID1234567812345678
ECC salt密码学人【CipherHUB】
ECC hashsha512
ECC derived key length32

十一、主结果键(–raw 模式)

命令主结果键
hashdigest
hmachmac
aes/sm4/zuc encryptcipher
aes/sm4/zuc decryptplain
random-strvalue 或 output_file
rsa generatepublic_file
rsa encryptcipher
rsa decryptplain
rsa signsignature
rsa verifyvalid
ecc generatepublic_file
ecc ecdhkey
ecc signsignature
ecc verifyvalid
sm2 generatepublic_file
sm2 encryptcipher
sm2 decryptplain
sm2 signsignature
sm2 verifyvalid