Mac

Mac上生成RSA公钥和私钥

"openssl"

Posted by Mzx on January 10, 2017

Mac上生成RSA公钥和私钥

rsa加密需要用到公钥和私钥,所以接下来将演示如何用mac上自带的openssl生成rsa公钥和私钥

// step 1
$ openssl //在终端输入openssl 开启openssl shell
// step 2 
OpenSSL> genrsa -out rsa_private_key.pem 1024
// step 3
OpenSSL> pkcs8 -topk8 -inform PEM -in rsa_private_key.pem -outform PEM –nocrypt
// step 4
OpenSSL> rsa -in rsa_private_key.pem -out rsa_public_key.pem -pubout

执行上面四步后,在当前目录下就会生成名称为 rsa_private_key.pem的私钥和名称为rsa_public_key.pem 的公钥。