openssl command line: usage of RSA -- Ultimate Edition

1. Generate the key
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. View the key
openssl rsa -in test2048_priv.pem -text -out
openssl rsa -in test3072_priv.pem -text -out
openssl rsa -in test4096_priv.pem -text -out

Insert image description here

3. Signature, verification, encryption and decryption based on PKCS1v1.5 Pending

(1) Signature and verification

  • openssl dgst -sign test2048_priv.pem -sha256 -out sign.txt in.txt
  • openssl dgst -verify test2048_pub.pem -sha256 -signature sign.txt in.txt

Insert image description here

(2) Encryption

Guess you like

Origin blog.csdn.net/weixin_42135087/article/details/132791427