你的位置:首页 > 操作系统

[操作系统]使用mac终端生成RSA私钥和公钥文件


89:~ zhangwenquan$ 

89:~ zhangwenquan$ openssl

OpenSSL> genrsa -out rsa_private_key.pem 1024

Generating RSA private key, 1024 bit long modulus

..........++++++

..................++++++

e is 65537 (0x10001)

OpenSSL> pkcs8 -topk8 -inform PEM -in rsa_private_key.pem -outform PEM -nocrypt

-----BEGIN PRIVATE KEY-----

MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBALldSA5HtPvyhEUK

a6M+Cn2jwUQx1lekTK0gM7jSFhzKhcY7ADeVhL+AjGtnYvlGY+npOEM1DqJPBBiu

cbPkyBtPHErZRjN0r0rZiqS0AY7j/EvG656W8S+rhN59AWtV3zuCF0C6pOWnUiMr

7GcyQR1qoX2BN7R2kr8ZwM92WroNAgMBAAECgYAhpMuqQ9uWixr0yQJmW6Fd0nYG

oaEMwTZlid25YvA+g4eqRhUxAYNZmsRhzh8JrXv+/aSHlj60uPC+ZhMfGpwzAYo1

I0KR+dQT5uoP1nhqVZev+cXICabJ3gKCzbvdIFz1TxL8NJw1UlssNLtxdn68QVWh

/wSz/7ppGdKrgVIM4QJBAOS36NuVMsut6iPxLmtOpRz+VTZj8jS1yXz0/sv+WIoj

zcBabuMTVixMvuK49dBZTTOd5AXCizzKDx4qdD/VdUkCQQDPeYYjJTbi2rsOsyoK

+CcMnTYLJN8fWLNR3vLGoHxayOMHDW8Lfc4YrZJCGzoSuR3ikMZBOf9mXjO2NNsu

TxKlAkAqyGgLYw48YUzR6lR3iB+Em+KOqQVubK7C7AUZXXtsY6QiHght+3j8EmMG

f/ijP4EcbaVwmmJ3PYi0aNaT9jbZAkBJQxpQssVs2dwP1shT00jGtYTt7nkzcnjv

whBsfyMqU6GHTgEWR7hNEo2A9mhNUDzzUjgPtFExbrZH8uYqthVZAkB2/TLnvwDM

fzXIlSUTWi5nqILJhNWzY5l3XC03iH0WEvCi5QGNsOsvomdX7Krj0Imavc2L9hVj

fELfsTQfy0Dz

-----END PRIVATE KEY-----

OpenSSL> rsa -in rsa_private_key.pem -pubout -out rsa_public_key.pem

writing RSA key

OpenSSL>

 

红色是要输入的命令。

 

 

 

这个红色的框是pkcs8 格式的    要记得复制下来   后台要用。

 

 

然后前往文件夹  寻找pem证书

 

 

 

 

 

这就是要生成的  pem 文件