使用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