使用openssl生成crt证书


转发:https://www.jianshu.com/p/30f7d7e9539d

检查是否安装了 openssl

[root@DEV-YWZTV1-SE02 conf]# openssl version
OpenSSL 1.0.1e-fips 11 Feb 2013

创建证书密钥文件 server.key

使用 openssl 命令,创建服务器证书 密钥文件 :server.key

openssl genrsa -des3 -out server.key 1024

下面要输入密码:可随意定义,现在把密码设置成123456,密码后面会用到。

创建证书申请文件:server.csr

使用 openssl 命令,创建服务器证书 申请文件:server.csr

openssl req -new -key server.key -out server.csr
输出内容为:
Enter pass phrase for root.key: ← 输入前面创建的密码
Country Name (2 letter code) [AU]:CN ← 国家代号,中国输入CN
State or Province Name (full name) [Some-State]:BeiJing ← 省的全名,拼音
Locality Name (eg, city) []:BeiJing ← 市的全名,拼音
Organization Name (eg, company) [Internet Widgits Pty Ltd]:MyCompany Corp. ← 公司英文名
Organizational Unit Name (eg, section) []: ← 可以不输入
Common Name (eg, YOUR name) []: ← 此时不输入
Email Address []:admin@mycompany.com ← 电子邮箱,可随意填
Please enter the following ‘extra’ attributes
to be sent with your certificate request
A challenge password []: ← 可以不输入
An optional company name []: ← 可以不输入

备份一份服务器密钥文件 server.key.org

cp server.key server.key.org

去除文件口令 server.key

openssl rsa -in server.key.org -out server.key

生成证书文件server.crt

openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

qq_26264237

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值