macOS生成RSA密钥

生成不加密的私钥

1
2
openssl genrsa -out rsa_private_key.pem 1024
openssl pkcs8 -in rsa_private_key.pem -out rsa_private_key_pkcs8.pem -nocrypt -topk8

生成对应私钥的公钥

1
2
openssl rsa -in rsa_private_key.pem -out rsa_public_key.pem -pubout
openssl rsa -in rsa_private_key_pkcs8.pem -out rsa_public_key_pkcs8.pem -pubout