1、生成密钥
openssl genrsa -out test2048_priv.pem 2048
openssl rsa -pubout -in test2048_priv.pem -out test2048_pub.pem
openssl genrsa -out test3072_priv.pem 3072
openssl rsa -pubout -in test3072_priv.pem -out test3072_pub.pem
openssl genrsa -out test4096_priv.pem 4096
openssl rsa -pubout -in test4096_priv.pem -out test4096_pub.pem
2、查看密钥
openssl rsa -in test2048_priv.pem -text -out
openssl rsa -in test3072_priv.pem -text -out
openssl rsa -in test4096_priv.pem -text -out
3、基于 PKCS1v1.5 Pending的 签名、验签、加密、解密
(1) 签名和验签
- openssl dgst -sign test2048_priv.pem -sha256 -out sign.txt in.txt
- openssl dgst -verify test2048_pub.pem -sha256 -signature sign.txt in.txt
(2)加密