OpenSSL 3.5 命令行 cheatsheet

openssl命令cheatsheet

参考链接
Linux Man文档openssl-3.5.0:openssl-pkeyutl.1ssl.en
无需找借口:OpenSSL 进入量子时代
Openssl官方3.5文档

ML-KEM

ML-KEM密钥对生成

openssl genpkey -algorithm ML-KEM-512 -out ML-KEM-512_priv.pem

ML-KEM密钥对打印

openssl pkey -in ML-KEM-512_priv.pem -noout -text

ML-KEM公钥导出(公钥生成)

openssl pkey -in ML-KEM-512_priv.pem -pubout -out ML-KEM-512_pub.pem

mlkem公钥打印

openssl pkey -pubin -in ML-KEM-512_pub.pem -noout -text

ML-KEM 封装

openssl pkeyutl -encap -inkey ML-KEM-512_pub.pem -secret encap.dat -out ciphertext.dat

ML-KEM解封装

openssl pkeyutl -decap -inkey ML-KEM-512_priv.pem -secret decap.dat < ciphertext.dat

ML-DSA

ML-DSA密钥对生成

openssl genpkey -algorithm ML-DSA-44 -out ML-DSA-44_priv.pem

ML-DSA密钥对打印

openssl pkey -in ML-DSA-44_priv.pem -noout -text

ML-DSA公钥导出(公钥生成)

openssl pkey -in ML-DSA-44_priv.pem -pubout -out ML-DSA-44_pub.pem

mldsa公钥打印

openssl pkey -pubin -in ML-DSA-44_pub.pem -noout -text

ML-DSA签名生成 (Explicit digest not supported for ML-DSA operations)

openssl pkeyutl -sign -in raw-file.bin -inkey ML-DSA-44_priv.pem -out signature.bin

openssl dgst -sign ML-DSA-44_priv.pem -out signature.bin raw-file.bin

ML-DSA签名验证

openssl pkeyutl -verify -in raw-file.bin -sigfile signature.bin -inkey ML-DSA-44_pub.pem

SM2密钥对生成

openssl ecparam -name sm2 -genkey -out sm2.priv.pem

SM2密钥对打印

openssl pkey -in sm2.priv.pem -noout -text

SM2公钥导出

openssl pkey -in sm2.priv.pem -pubout -out sm2.pub.pem

公钥打印

openssl pkey -pubin -in sm2.pub.pem -noout -text

posted @ 2025-04-20 15:30  北壹  阅读(103)  评论(0)    收藏  举报