MAC OS 自带的openSSL生成公钥私钥

MAC OS自带了OpenSSL,直接在命令行里使用OPENSSL就可以。

打开命令行工具,然后输入openssl打开openssl,接着只要三句命令就可以搞定。第一句命令生成私钥;第二句命令把RSA私钥转换成PKCS8格式,密码为空就行;第三句命令生成公钥。


Last login: Fri Sep 12 00:59:51 on ttys000

stormerdeiMac:~ stormer$ openssl

OpenSSL> genrsa -outrsa_private_key.pem 1024

Generating RSA private key, 1024 bit long modulus

....++++++

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

e is 65537 (0x10001)

OpenSSL> pkcs8 -topk8 -inform PEM -inrsa_private_key.pem -outform PEM –nocrypt

Enter Encryption Password:

Verifying - Enter Encryption Password:

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

MIICoTAbBgkqhkiG9w0BBQMwDgQIStQxV5Ap0rECAggABIICgCN+n27Qujr/tQ5B

sTUoYmJWY+SBkv4NdwKFgkqPODbbVnpyLyDXO5BDgyjql6mdrOnGmYL1GYoNWHiy

BlBVvGLVwZodummJIVYRTyQoeazUSsdv0ahxf1mpSvhJzHpycUwPo9BY+uLCFISq

bqaZoHhQeKy48+tqSlv1gcff4PFjaws9TUoHQ/S65FYs/Jhhso3fGYIH3jPeU73K

kmKa4Y5tJWdj5SChJPZKUR3/1hw4+KQqpVrTNwkov98gIYhrls/lFTHTM9iWKVY+

GXc2SEbnyDZwx6Wu4N6wnM5iXKNh+wPMM2Fwsml9Pcqh2Z2spG0yaKARhCiVKPTn

mtVK5QcLYlSqmLF/Z3DkI2Pd4ve//1dsyHr9gO+GK0BX1B6ihx0yf21gMRULH7PS

qmQJrMtQCyUfJNtKViVub/dsXGb9bgecAX8xzP2kBlfuNnle45gCTAlqQ53OkCM6

M41P+RQdgJ4OQXVMiiIRZzmYCn+Mxz64B7f5DFU+7tMMQV2rpPBr4aWCXOllkU/Z

h7eRLfnxzoTgm29KIYTabiwQMxa03o9pzJeI9yFvmdwwA40wGknh5PJTFsUJw57r

KV6qZpP8cHzydWqLyJBJ0s2YOALuZI8nd2y3lGK3eyWqDERcD0ChH1sraV2jccB+

oHAq4OU1rAskukhvP7GxUkut7yZGZ9b57L0ILP+764OZOqMlmwsTbO3oKaHi7YeV

xlTS9WQFw2cde1FJXV/IpHR1+mU7OdIXLRQwcWwrguSSEhD4V6YKN5mO69XPuTzD

Q5qYvo7HtFg8SQ6pQZMQFQE0xS7tHf9DjP+XjXUUwJx8C9DPZlMB02bH47cMG6Jf

Q/Zb1I4=

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

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

writing RSA key


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值