下面是OPENSSL生成密鑰對示例:
一,使用RSA算法:
生成私鑰:openssl genrsa -out privatekey.key 1024
查看:openssl rsa -in privatekey.key -noout -text
對應公鑰:openssl rsa -in privatekey.key -pubout -out pubkey.key
查看:openssl rsa -pubin -in pubkey.key -noout -text
二,使用DSA算法:
生成DSA參數:openssl dsaparam -out dsa_param.pem 1024
生成私鑰:openssl gendsa -out dsa_private_key.pem dsa_param.pem
對應公鑰:openssl dsa -in dsa_private_key.pem -pubout -out dsa_public_key.pem
三:根據私鑰生成證書簽名請求
openssl req -new -key privatekey.key -out csr.pem
![](https://news.xinpengboligang.com/upload/keji/bb7a6086bccf9e6d34a1e06357feab67.jpeg)
查看
openssl req -noout -text -in csr.pem