Linux command
gmssl 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Generate SM2 key pair
gmssl sm2keygen -pass [password] -out [key.pem]
Compute SM3 hash of a file
gmssl sm3 < [file]
Encrypt with SM4
gmssl sm4 -encrypt -in [plaintext.txt] -out [ciphertext.bin]
Decrypt with SM4
gmssl sm4 -decrypt -in [ciphertext.bin] -out [plaintext.txt]
Generate random bytes
gmssl rand -hex [32]
Sign with SM2
gmssl sm2sign -key [key.pem] -pass [password] -in [file] -out [sig]
说明
GmSSL is an open-source cryptographic toolkit supporting Chinese national cryptographic algorithms (GuoMi/GM). It provides implementations of SM2 (elliptic curve cryptography), SM3 (hash function), SM4 (block cipher), SM9 (identity-based cryptography), and ZUC (stream cipher). The command-line interface is similar to OpenSSL.
参数
- -in _file_
- Input file.
- -out _file_
- Output file.
- -pass _password_
- Key password.
- -encrypt
- Encrypt mode.
- -decrypt
- Decrypt mode.
- -hex
- Output in hexadecimal.
FAQ
What is the gmssl command used for?
GmSSL is an open-source cryptographic toolkit supporting Chinese national cryptographic algorithms (GuoMi/GM). It provides implementations of SM2 (elliptic curve cryptography), SM3 (hash function), SM4 (block cipher), SM9 (identity-based cryptography), and ZUC (stream cipher). The command-line interface is similar to OpenSSL.
How do I run a basic gmssl example?
Run `gmssl sm2keygen -pass [password] -out [key.pem]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -in _file_ do in gmssl?
Input file.