Mac OS uses openssl to generate RSA public key and public key

Mac OS comes with openssl, you can run openssl directly from the command line.
Open a terminal and enter the specified directory:

cd /test/rsa/key
openssl

//生成一个1024位的私钥
genrsa -out rsa_private_key.pem 1024

//利用私钥生成JAVA支持的PKCS8类型的私钥
pkcs8 -topk8 -inform PEM -in rsa_private_key.pem -outform PEM -nocrypt -out rsa_private_pkcs8_key.pem

//生成公钥
rsa -in rsa_private_key.pem -pubout -out rsa_public_key.pem

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326487456&siteId=291194637