Easy Encryption Tool常用命令

具有更加友好输出模式的 eet 使用说明

2026-02-18 21:49 CST  · 5000 words  · 10 min

Easy Encryption Tool使用说明

版本:2.1.8 易加密小工具 - 常用密码学操作命令行工具,支持 AES、SM4、RSA、ECC、SM2、ZUC、哈希、HMAC、证书解析等。 目录 快速入门 主命令与全局帮助 version - 版本信息 aes - AES 加解密 sm4 - SM4 国密加解密 random-str - 随机字符串生成 hash - 哈希摘要 hmac - HMAC 消息验证码 rsa - RSA 加解密与签名验签 ecc - ECC 签名验签与密钥交换 sm2 - SM2 国密加解密与签名验签 zuc - ZUC 祖冲之流密码 cert-parse - 证书解析 1. 快速入门 1.1 安装与调用 1 2 3 # 安装后可通过以下方式调用 pip install easy-encryption-tool\[gmssl\] --upgrade easy_encryption_tool --help ...

2026-02-17 09:42 CST  · 5123 words  · 11 min

Easy Encryption Tool能力清单

本文档枚举 easy_encryption_tool 支持的所有能力,提供输入参数和完整命令行,便于逐项执行并与 CipherHUB 比对结果。 默认测试数据(与 CipherHUB 兼容): 明文:你好,密码学人 CipherHUB! AES/SM4 key(32):01234567890123456789012345678901 AES/SM4 key(16):0123456789012345 IV(16):0123456789012345 Nonce(12):012345678901234567890123 AAD:密码学人 CipherHUB 默认 AAD 数据 ZUC key/iv:0123456789012345 HMAC key:01234567890123456789012345678901 SM2 signer_id:1234567812345678 1. version - 版本信息 序号 能力 输入参数 完整命令行 1.1 显示版本及运行时信息 无 easy_encryption_tool version 2. random-str - 随机字符串生成 序号 能力 输入参数 完整命令行 2.1 生成 32 字节随机字符串(stdout) -l 32 easy_encryption_tool random-str -l 32 2.2 生成 64 字节随机字符串 -l 64 easy_encryption_tool random-str -l 64 2.3 输出到文件 -l 32 -o /tmp/rand.txt easy_encryption_tool random-str -l 32 -o /tmp/rand.txt 3. hash - 哈希摘要 序号 能力 输入参数 完整命令行 3.1 SHA256 字符串 -i “你好,密码学人 CipherHUB!” -a sha256 easy_encryption_tool hash -i "你好,密码学人 CipherHUB!" -a sha256 3.2 SHA384 字符串 -i “你好,密码学人 CipherHUB!” -a sha384 easy_encryption_tool hash -i "你好,密码学人 CipherHUB!" -a sha384 3.3 SHA512 字符串 -i “你好,密码学人 CipherHUB!” -a sha512 easy_encryption_tool hash -i "你好,密码学人 CipherHUB!" -a sha512 3.4 SM3 字符串(需 easy_gmssl) -i “你好,密码学人 CipherHUB!” -a sm3 easy_encryption_tool hash -i "你好,密码学人 CipherHUB!" -a sm3 3.5 SHA256 base64 输入 -i “5L2g5aW977yM5a+G56CB5a2m5Lq6IENpcGhlckhVQiE=” -e -a sha256 easy_encryption_tool hash -i "5L2g5aW977yM5a+G56CB5a2m5Lq6IENpcGhlckhVQiE=" -e -a sha256 3.6 SHA256 文件 -i /path/to/file -f -a sha256 easy_encryption_tool hash -i /path/to/file -f -a sha256 4. hmac - HMAC 消息验证码 序号 能力 输入参数 完整命令行 4.1 HMAC-SHA256 默认 key -i “你好,密码学人 CipherHUB!” easy_encryption_tool hmac -i "你好,密码学人 CipherHUB!" 4.2 HMAC-SHA256 指定 key -i “你好,密码学人 CipherHUB!” -k 01234567890123456789012345678901 easy_encryption_tool hmac -i "你好,密码学人 CipherHUB!" -k 01234567890123456789012345678901 4.3 HMAC-SHA384 -i “你好,密码学人 CipherHUB!” -a sha384 -k 01234567890123456789012345678901 easy_encryption_tool hmac -i "你好,密码学人 CipherHUB!" -a sha384 -k 01234567890123456789012345678901 4.4 HMAC-SHA512 -i “你好,密码学人 CipherHUB!” -a sha512 -k 01234567890123456789012345678901 easy_encryption_tool hmac -i "你好,密码学人 CipherHUB!" -a sha512 -k 01234567890123456789012345678901 4.5 HMAC-SM3(需 easy_gmssl) -i “你好,密码学人 CipherHUB!” -a sm3 -k 01234567890123456789012345678901 easy_encryption_tool hmac -i "你好,密码学人 CipherHUB!" -a sm3 -k 01234567890123456789012345678901 4.6 HMAC base64 输入 -i “5L2g5aW977yM5a+G56CB5a2m5Lq6IENpcGhlckhVQiE=” -e -k 01234567890123456789012345678901 easy_encryption_tool hmac -i "5L2g5aW977yM5a+G56CB5a2m5Lq6IENpcGhlckhVQiE=" -e -k 01234567890123456789012345678901 4.7 HMAC 文件 -i /path/to/file -f -k 01234567890123456789012345678901 easy_encryption_tool hmac -i /path/to/file -f -k 01234567890123456789012345678901 5. aes - AES 对称加解密 5.1 AES-CBC 序号 能力 输入参数 完整命令行 5.1.1 CBC 加密字符串 -m cbc -a encrypt -i “你好,密码学人 CipherHUB!” easy_encryption_tool aes -m cbc -a encrypt -i "你好,密码学人 CipherHUB!" 5.1.2 CBC 加密(指定 key/iv) -m cbc -a encrypt -i “你好,密码学人 CipherHUB!” -k 01234567890123456789012345678901 -v 0123456789012345 easy_encryption_tool aes -m cbc -a encrypt -i "你好,密码学人 CipherHUB!" -k 01234567890123456789012345678901 -v 0123456789012345 5.1.3 CBC 解密 先执行 5.1.2 获取 cipher,再解密 easy_encryption_tool aes -m cbc -a decrypt -i "<上一步输出的cipher>" -e -k 01234567890123456789012345678901 -v 0123456789012345 5.1.4 CBC 加密 base64 输入 -m cbc -a encrypt -i “5L2g5aW977yM5a+G56CB5a2m5Lq6IENpcGhlckhVQiE=” -e -k 01234567890123456789012345678901 -v 0123456789012345 easy_encryption_tool aes -m cbc -a encrypt -i "5L2g5aW977yM5a+G56CB5a2m5Lq6IENpcGhlckhVQiE=" -e -k 01234567890123456789012345678901 -v 0123456789012345 5.1.5 CBC 加密文件 -m cbc -a encrypt -i /path/to/plain.txt -f -o /tmp/cipher.bin -k 01234567890123456789012345678901 -v 0123456789012345 easy_encryption_tool aes -m cbc -a encrypt -i /path/to/plain.txt -f -o /tmp/cipher.bin -k 01234567890123456789012345678901 -v 0123456789012345 5.1.6 CBC 解密文件 -m cbc -a decrypt -i /tmp/cipher.bin -f -o /tmp/plain.txt -k 01234567890123456789012345678901 -v 0123456789012345 easy_encryption_tool aes -m cbc -a decrypt -i /tmp/cipher.bin -f -o /tmp/plain.txt -k 01234567890123456789012345678901 -v 0123456789012345 5.2 AES-GCM 序号 能力 输入参数 完整命令行 5.2.1 GCM 加密字符串 -m gcm -a encrypt -i “你好,密码学人 CipherHUB!” -k 01234567890123456789012345678901 -v 012345678901234567890123 easy_encryption_tool aes -m gcm -a encrypt -i "你好,密码学人 CipherHUB!" -k 01234567890123456789012345678901 -v 012345678901234567890123 5.2.2 GCM 解密(需 tag) 先执行 5.2.1 获取 cipher 和 auth_tag easy_encryption_tool aes -m gcm -a decrypt -i "<cipher>" -e -t "<auth_tag>" -k 01234567890123456789012345678901 -v 012345678901234567890123 5.2.3 GCM 加密文件 -m gcm -a encrypt -i /path/to/plain.txt -f -o /tmp/gcm_cipher.bin -k 01234567890123456789012345678901 -v 012345678901234567890123 easy_encryption_tool aes -m gcm -a encrypt -i /path/to/plain.txt -f -o /tmp/gcm_cipher.bin -k 01234567890123456789012345678901 -v 012345678901234567890123 5.2.4 GCM 解密文件 需保存 5.2.3 输出的 auth_tag easy_encryption_tool aes -m gcm -a decrypt -i /tmp/gcm_cipher.bin -f -o /tmp/plain.txt -t "<auth_tag>" -k 01234567890123456789012345678901 -v 012345678901234567890123 6. sm4 - SM4 国密对称加解密(需 easy_gmssl) 6.1 SM4-CBC 序号 能力 输入参数 完整命令行 6.1.1 SM4-CBC 加密字符串 -m cbc -a encrypt -i “你好,密码学人 CipherHUB!” -k 0123456789012345 -v 0123456789012345 easy_encryption_tool sm4 -m cbc -a encrypt -i "你好,密码学人 CipherHUB!" -k 0123456789012345 -v 0123456789012345 6.1.2 SM4-CBC 解密 先执行 6.1.1 获取 cipher easy_encryption_tool sm4 -m cbc -a decrypt -i "<cipher>" -e -k 0123456789012345 -v 0123456789012345 6.1.3 SM4-CBC 加密文件 -m cbc -a encrypt -i /path/to/plain.txt -f -o /tmp/sm4_cipher.bin -k 0123456789012345 -v 0123456789012345 easy_encryption_tool sm4 -m cbc -a encrypt -i /path/to/plain.txt -f -o /tmp/sm4_cipher.bin -k 0123456789012345 -v 0123456789012345 6.1.4 SM4-CBC 解密文件 -m cbc -a decrypt -i /tmp/sm4_cipher.bin -f -o /tmp/plain.txt -k 0123456789012345 -v 0123456789012345 easy_encryption_tool sm4 -m cbc -a decrypt -i /tmp/sm4_cipher.bin -f -o /tmp/plain.txt -k 0123456789012345 -v 0123456789012345 6.2 SM4-GCM 序号 能力 输入参数 完整命令行 6.2.1 SM4-GCM 加密字符串 -m gcm -a encrypt -i “你好,密码学人 CipherHUB!” -k 0123456789012345 -v 012345678901234567890123 –aad “密码学人 CipherHUB 默认 AAD 数据” easy_encryption_tool sm4 -m gcm -a encrypt -i "你好,密码学人 CipherHUB!" -k 0123456789012345 -v 012345678901234567890123 --aad "密码学人 CipherHUB 默认 AAD 数据" 6.2.2 SM4-GCM 解密 先执行 6.2.1 获取 cipher 和 auth_tag easy_encryption_tool sm4 -m gcm -a decrypt -i "<cipher>" -e -t "<auth_tag>" -k 0123456789012345 -v 012345678901234567890123 --aad "密码学人 CipherHUB 默认 AAD 数据" 7. zuc - ZUC 祖冲之流密码(需 easy_gmssl) 序号 能力 输入参数 完整命令行 7.1 ZUC 加密字符串 -a encrypt -i “你好,密码学人 CipherHUB!” -k 0123456789012345 -v 0123456789012345 easy_encryption_tool zuc -a encrypt -i "你好,密码学人 CipherHUB!" -k 0123456789012345 -v 0123456789012345 7.2 ZUC 解密 先执行 7.1 获取 cipher easy_encryption_tool zuc -a decrypt -i "<cipher>" -e -k 0123456789012345 -v 0123456789012345 7.3 ZUC 加密文件 -a encrypt -i /path/to/plain.txt -f -o /tmp/zuc_cipher.bin -k 0123456789012345 -v 0123456789012345 easy_encryption_tool zuc -a encrypt -i /path/to/plain.txt -f -o /tmp/zuc_cipher.bin -k 0123456789012345 -v 0123456789012345 7.4 ZUC 解密文件 -a decrypt -i /tmp/zuc_cipher.bin -f -o /tmp/plain.txt -k 0123456789012345 -v 0123456789012345 easy_encryption_tool zuc -a decrypt -i /tmp/zuc_cipher.bin -f -o /tmp/plain.txt -k 0123456789012345 -v 0123456789012345 8. rsa - RSA 非对称加解密与签名验签 8.1 密钥生成 序号 能力 输入参数 完整命令行 8.1.1 生成 2048 位 PEM 密钥对(无密码) -f rsa_test easy_encryption_tool rsa generate -f rsa_test 8.1.2 生成 4096 位 PEM 密钥对(带密码) -f rsa_test -s 4096 -p 1234567890 easy_encryption_tool rsa generate -f rsa_test -s 4096 -p 1234567890 8.1.3 生成 DER 格式密钥对 -f rsa_test -e der -s 2048 easy_encryption_tool rsa generate -f rsa_test -e der -s 2048 8.1.4 生成随机密码的密钥对 -f rsa_test -s 2048 -r easy_encryption_tool rsa generate -f rsa_test -s 2048 -r 8.2 RSA 加解密 序号 能力 输入参数 完整命令行 8.2.1 OAEP-SHA256 加密 -f rsa_test_rsa_public.pem -i “你好,密码学人 CipherHUB!” -m oaep -h sha256 easy_encryption_tool rsa encrypt -f rsa_test_rsa_public.pem -i "你好,密码学人 CipherHUB!" -m oaep -h sha256 8.2.2 OAEP-SHA256 解密(无密码私钥) -f rsa_test_rsa_private.pem -i “” -m oaep -h sha256 easy_encryption_tool rsa decrypt -f rsa_test_rsa_private.pem -i "<cipher>" -m oaep -h sha256 8.2.3 OAEP-SHA256 解密(带密码私钥) -f rsa_test_rsa_private_cipher.pem -i “” -m oaep -h sha256 -p 1234567890 easy_encryption_tool rsa decrypt -f rsa_test_rsa_private_cipher.pem -i "<cipher>" -m oaep -h sha256 -p 1234567890 8.2.4 OAEP-SHA384 加解密 -m oaep -h sha384 easy_encryption_tool rsa encrypt -f rsa_test_rsa_public.pem -i "你好,密码学人 CipherHUB!" -m oaep -h sha384 8.2.5 OAEP-SHA512 加解密 -m oaep -h sha512 easy_encryption_tool rsa encrypt -f rsa_test_rsa_public.pem -i "你好,密码学人 CipherHUB!" -m oaep -h sha512 8.2.6 PKCS1v15 加解密 -m pkcs1v15 easy_encryption_tool rsa encrypt -f rsa_test_rsa_public.pem -i "你好,密码学人 CipherHUB!" -m pkcs1v15 8.2.7 base64 输入加密 -f rsa_test_rsa_public.pem -i “5L2g5aW977yM5a+G56CB5a2m5Lq6IENpcGhlckhVQiE=” -c -m oaep easy_encryption_tool rsa encrypt -f rsa_test_rsa_public.pem -i "5L2g5aW977yM5a+G56CB5a2m5Lq6IENpcGhlckhVQiE=" -c -m oaep 8.3 RSA 签名验签 序号 能力 输入参数 完整命令行 8.3.1 PSS-SHA256 签名 -f rsa_test_rsa_private.pem -i “你好,密码学人 CipherHUB!” -m pss -h sha256 easy_encryption_tool rsa sign -f rsa_test_rsa_private.pem -i "你好,密码学人 CipherHUB!" -m pss -h sha256 8.3.2 PSS-SHA256 验签 -f rsa_test_rsa_public.pem -i “你好,密码学人 CipherHUB!” -m pss -s “” easy_encryption_tool rsa verify -f rsa_test_rsa_public.pem -i "你好,密码学人 CipherHUB!" -m pss -s "<signature>" 8.3.3 PSS 签名(带密码私钥) -f rsa_test_rsa_private_cipher.pem -i “你好,密码学人 CipherHUB!” -m pss -p 1234567890 easy_encryption_tool rsa sign -f rsa_test_rsa_private_cipher.pem -i "你好,密码学人 CipherHUB!" -m pss -p 1234567890 8.3.4 PKCS1v15 签名验签 -m pkcs1v15 easy_encryption_tool rsa sign -f rsa_test_rsa_private.pem -i "你好,密码学人 CipherHUB!" -m pkcs1v15 9. ecc - ECC 椭圆曲线签名验签与密钥交换 9.1 密钥生成 序号 能力 输入参数 完整命令行 9.1.1 生成 secp256k1 密钥对 -f ecc_test easy_encryption_tool ecc generate -f ecc_test 9.1.2 生成 secp256r1 密钥对 -f ecc_test -c secp256r1 easy_encryption_tool ecc generate -f ecc_test -c secp256r1 9.1.3 生成 secp384r1 带密码 -f ecc_test -c secp384r1 -p 1234567890 easy_encryption_tool ecc generate -f ecc_test -c secp384r1 -p 1234567890 9.1.4 生成 secp521r1 DER 格式 -f ecc_test -c secp521r1 -e der easy_encryption_tool ecc generate -f ecc_test -c secp521r1 -e der 9.2 ECDH 密钥交换 序号 能力 输入参数 完整命令行 9.2.1 ECDH 派生共享密钥(alice 视角) 需先生成 alice、bob 密钥对 easy_encryption_tool ecc ecdh -a alice_ecc_public.pem -k alice_ecc_private_cipher.pem -p 1234567890 -b bob_ecc_public.pem -l 32 -s "密码学人【CipherHUB】" -c "ecc handshake context data" 9.2.2 ECDH 派生共享密钥(bob 视角) 与 9.2.1 使用相同 salt/context easy_encryption_tool ecc ecdh -a bob_ecc_public.pem -k bob_ecc_private_cipher.pem -p 1234567890 -b alice_ecc_public.pem -l 32 -s "密码学人【CipherHUB】" -c "ecc handshake context data" 9.2.3 ECDH 指定 hash 和 length -h sha256 -l 64 easy_encryption_tool ecc ecdh -a alice_ecc_public.pem -k alice_ecc_private_cipher.pem -p 1234567890 -b bob_ecc_public.pem -l 64 -h sha256 -s "密码学人【CipherHUB】" -c "ecc handshake context data" 9.3 ECC 签名验签 序号 能力 输入参数 完整命令行 9.3.1 ECDSA-SHA256 签名 -f ecc_test_ecc_private.pem -i “你好,密码学人 CipherHUB!” -h sha256 easy_encryption_tool ecc sign -f ecc_test_ecc_private.pem -i "你好,密码学人 CipherHUB!" -h sha256 9.3.2 ECDSA-SHA256 验签 -f ecc_test_ecc_public.pem -i “你好,密码学人 CipherHUB!” -s “” easy_encryption_tool ecc verify -f ecc_test_ecc_public.pem -i "你好,密码学人 CipherHUB!" -s "<signature>" 9.3.3 ECDSA-SHA384 签名验签 -h sha384 easy_encryption_tool ecc sign -f ecc_test_ecc_private.pem -i "你好,密码学人 CipherHUB!" -h sha384 9.3.4 ECDSA-SHA512 签名验签 -h sha512 easy_encryption_tool ecc sign -f ecc_test_ecc_private.pem -i "你好,密码学人 CipherHUB!" -h sha512 9.3.5 base64 输入签名 -i “5L2g5aW977yM5a+G56CB5a2m5Lq6IENpcGhlckhVQiE=” -c easy_encryption_tool ecc sign -f ecc_test_ecc_private.pem -i "5L2g5aW977yM5a+G56CB5a2m5Lq6IENpcGhlckhVQiE=" -c 10. sm2 - SM2 国密加解密与签名验签(需 easy_gmssl) 10.1 密钥生成 序号 能力 输入参数 完整命令行 10.1.1 生成 SM2 密钥对 -f sm2_test -p 1234567890 easy_encryption_tool sm2 generate -f sm2_test -p 1234567890 10.1.2 生成随机密码的 SM2 密钥对 -f sm2_test -r easy_encryption_tool sm2 generate -f sm2_test -r 10.2 SM2 加解密 序号 能力 输入参数 完整命令行 10.2.1 SM2 加密 C1C3C2_ASN1 -f sm2_test_sm2_public.pem -i “你好,密码学人 CipherHUB!” -m C1C3C2_ASN1 easy_encryption_tool sm2 encrypt -f sm2_test_sm2_public.pem -i "你好,密码学人 CipherHUB!" -m C1C3C2_ASN1 10.2.2 SM2 解密 C1C3C2_ASN1 -f sm2_test_sm2_private.pem -i “” -p 1234567890 easy_encryption_tool sm2 decrypt -f sm2_test_sm2_private.pem -i "<cipher>" -p 1234567890 10.2.3 SM2 加密 C1C3C2 -m C1C3C2 easy_encryption_tool sm2 encrypt -f sm2_test_sm2_public.pem -i "你好,密码学人 CipherHUB!" -m C1C3C2 10.2.4 SM2 加密 C1C2C3_ASN1 -m C1C2C3_ASN1 easy_encryption_tool sm2 encrypt -f sm2_test_sm2_public.pem -i "你好,密码学人 CipherHUB!" -m C1C2C3_ASN1 10.2.5 SM2 加密 hex 输出 -o hex easy_encryption_tool sm2 encrypt -f sm2_test_sm2_public.pem -i "你好,密码学人 CipherHUB!" -o hex 10.2.6 SM2 解密 hex 输入 -x easy_encryption_tool sm2 decrypt -f sm2_test_sm2_private.pem -i "<hex_cipher>" -x -p 1234567890 10.3 SM2 签名验签 序号 能力 输入参数 完整命令行 10.3.1 SM2 签名 RS_ASN1 -f sm2_test_sm2_private.pem -i “你好,密码学人 CipherHUB!” -m RS_ASN1 -p 1234567890 easy_encryption_tool sm2 sign -f sm2_test_sm2_private.pem -i "你好,密码学人 CipherHUB!" -m RS_ASN1 -p 1234567890 10.3.2 SM2 验签 RS_ASN1 -f sm2_test_sm2_public.pem -i “你好,密码学人 CipherHUB!” -s “” easy_encryption_tool sm2 verify -f sm2_test_sm2_public.pem -i "你好,密码学人 CipherHUB!" -s "<signature>" 10.3.3 SM2 签名 RS 格式 -m RS easy_encryption_tool sm2 sign -f sm2_test_sm2_private.pem -i "你好,密码学人 CipherHUB!" -m RS -p 1234567890 10.3.4 SM2 指定 signer_id –signer-id 1234567812345678 easy_encryption_tool sm2 sign -f sm2_test_sm2_private.pem -i "你好,密码学人 CipherHUB!" -p 1234567890 --signer-id 1234567812345678 11. cert-parse - 证书解析 序号 能力 输入参数 完整命令行 11.1 解析 PEM 格式证书 -f /path/to/cert.pem -e pem easy_encryption_tool cert-parse -f /path/to/cert.pem -e pem 11.2 解析 DER 格式证书 -f /path/to/cert.der -e der easy_encryption_tool cert-parse -f /path/to/cert.der -e der 11.3 解析证书(详细模式) -f /path/to/cert.pem -e pem -v easy_encryption_tool cert-parse -f /path/to/cert.pem -e pem -v 11.4 解析国密 SM2 证书 -f /path/to/sm2_cert.pem -e pem -g easy_encryption_tool cert-parse -f /path/to/sm2_cert.pem -e pem -g 附录:测试执行检查清单 执行测试时建议按以下顺序准备测试数据: ...

2026-02-16 10:35 CST  · 3826 words  · 8 min

Easy Encryption Tool工具AI优化

本文档记录 2025-02-16 对 easy_encryption_tool 的 Vibecoding 实践:基于 easy_gmssl 2.0.1 将国密算法(SM2、SM3、SM4、ZUC)及国密证书解析能力集成进工具,在保持与既有国际算法(AES、RSA、ECC、HMAC)一致风格与体验的前提下,实现国密与国际算法的统一入口。 ...

2026-02-16 10:29 CST  · 2205 words  · 5 min
文章 Posts 分类 Categories 标签 Tags