博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
网站证书ssl
阅读量:6632 次
发布时间:2019-06-25

本文共 3716 字,大约阅读时间需要 12 分钟。

  hot3.png

方法一: #DNS验证下载ssl证书 cat certificate.crt、ca_bundle.crt >> server.crt vi server.crt 没有换行符,第二个文件需要在第一个文件的下一行粘贴,否则报错,证书无法使用

cat private.key > server.key

2.ssl.conf listen 443 ssl; servername img.xxx.com;

方法二: #创建根证书 openssl genrsa -des3 -out root.key openssl req -new -key root.key -out root.csr openssl x509 -req -days 3650 -sha1 -extensions v3_ca -signkey root.key -in root.csr -out root.crt #-------------------- #创建服务器证书 openssl genrsa -des3 -out server.key 2048 #去掉密码 openssl rsa -in server.key -out server.key openssl req -new -key server.key -out server.csr openssl x509 -req -days 730 -sha1 -extensions v3_req -CA root.crt -CAkey root.key -CAcreateserial -in server.csr -out server.crt #server.key and server.crt #=====================

  1. 创建根证书密钥文件(自己做CA)root.key: openssl genrsa -des3 -out root.key

  2. 创建根证书的申请文件root.csr:

    openssl req -new -key root.key -out root.csr 输出内容为:

    [lenin ~]$ openssl req -new -key root.key -out root.csr Enter pass phrase for root.key: ← 输入前面创建的密码 You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter ‘.’, the field will be left blank. —– 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 []: ← 电子邮箱,可随意填

    Please enter the following ‘extra’ attributes to be sent with your certificate request A challenge password []: ← 可以不输入 An optional company name []: ← 可以不输入

  3. 创建一个自当前日期起为期十年的根证书root.crt:

    openssl x509 -req -days 3650 -sha1 -extensions v3_ca -signkey root.key -in root.req -out root.crt

输出内容为:

[lenin[@archer](https://my.oschina.net/archer) ~]$ openssl x509 -req -days 3650 -sha1 -extensions v3_ca -signkey root.key -in root.csr -out root.crtSignature oksubject=/C=CN/ST=BeiJing/L=BeiJing/O=MyCompany Corp./emailAddress=admin@mycompany.comGetting Private keyEnter pass phrase for root.key: ← 输入前面创建的密码

#--------- 4. 创建服务器证书密钥server.key:

openssl genrsa –des3 -out server.key 2048

去除key文件口令的命令: openssl rsa -in server.key -out server.key

5.创建服务器证书的申请文件server.csr:

openssl req -new -key server.key -out server.csr

输出内容为:

[lenin[@archer](https://my.oschina.net/archer) ~]$ openssl req -new -key server.key -out server.reqYou are about to be asked to enter information that will be incorporatedinto your certificate request.What you are about to enter is what is called a Distinguished Name or a DN.There are quite a few fields but you can leave some blankFor some fields there will be a default value,If you enter ‘.’, the field will be left blank.—–Country Name (2 letter code) [AU]:CN ← 国家名称,中国输入CNState 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) []:www.mycompany.com ← 服务器主机名,若填写不正确,浏览器会报告证书无效,但并不影响使用Email Address []:admin@mycompany.com ← 电子邮箱,可随便填Please enter the following ‘extra’ attributesto be sent with your certificate requestA challenge password []: ← 可以不输入An optional company name []: ← 可以不输入
  1. 创建自当前日期起有效期为期两年的服务器证书server.crt:

    openssl x509 -req -days 730 -sha1 -extensions v3_req -CA root.crt -CAkey root.key -CAserial root.srl -CAcreateserial -in server.csr -out server.crt

转载于:https://my.oschina.net/jk409/blog/1609471

你可能感兴趣的文章
UVA340 UVALive5448 Master-Mind Hints
查看>>
软件开发活动
查看>>
数制与编码
查看>>
Python学习搬家啦
查看>>
FileInputStream
查看>>
mybatis springmvc批量删除 2最新
查看>>
java接口
查看>>
为什么程序员不擅长估算时间?
查看>>
设置dom节点属性的代码优化
查看>>
wait与sleep的区别
查看>>
Rotator的单位
查看>>
[Hyper-V]给Hyper-V创建两块网卡备用
查看>>
WebApi系列~安全校验中的防篡改和防复用
查看>>
pymysql 数据库编程
查看>>
<2048>调查报告心得与体会
查看>>
BM串匹配算法
查看>>
10款常见MySQL高可用方案选型解读
查看>>
最小生成树——Prim算法
查看>>
数据结构8——割点
查看>>
数据结构2——动态树
查看>>