原创文章,转载请注明出处:server非业余研究http://blog.csdn.net/erlib 作者Sunface


假设仅为了測试,那使用以下方法就可以:

測试证书创建:

1.创建证书的key

  1. $ openssl genrsa -out key.pem 1024

2.创建证书,注意这里的common name应该填你的server name

  1. $ openssl req -new -key key.pem -out request.pem
  2. Country Name (2 letter code) [AU]:UA
  3. State or Province Name (full name) [Some-State]:
  4. Locality Name (eg, city) []:Kiev
  5. Organization Name (eg, company) [Internet Widgits Pty Ltd]:site4fast blog
  6. Organizational Unit Name (eg, section) []:.
  7. Common Name (eg, YOUR name) []:site4fast.example.net
  8. Email Address []:site4fast@example.net
  9. Please enter the following 'extra' attributes
  10. to be sent with your certificate request
  11. A challenge password []:
  12. An optional company name []:

3.证书签字

  1. $ openssl x509 -req -days 30 -in request.pem -signkey key.pem -out certificate.pem

4.至此,我们须要的測试证书已经创建好了:"self-signed certificate".

正式的证书创建步骤:

1.安装CA证书

  1. $ aptitude install ssl-cert ca-certificates

2.在startssl.com注冊

3.创建一个请求
  1. $ openssl req -new -newkey rsa:2048 -nodes -keyout www_privatekey.pem -out www_csr.pem
  1. Generating a 2048 bit RSA private key
  2. ..................................++++++
  3. ....................++++++
  4. writing new private key to 'www_privatekey.pem'
  5. -----
  6. You are about to be asked to enter information that will be incorporated
  7. into your certificate request.
  8. What you are about to enter is what is called a Distinguished Name or a DN.
  9. There are quite a few fields but you can leave some blank
  10. For some fields there will be a default value,
  11. If you enter '.', the field will be left blank.
  12. -----
  13. Country Name (2 letter code) [AU]:UA
  14. State or Province Name (full name) [Some-State]:Some state
  15. Locality Name (eg, city) []:Some City
  16. Organization Name (eg, company) [Internet Widgits Pty Ltd]:Some Organisation
  17. Organizational Unit Name (eg, section) []:IT
  18. Common Name (eg, YOUR name) []:www.example.org
  19. Email Address []:test@example.org
  20. Please enter the following 'extra' attributes
  21. to be sent with your certificate request
  22. A challenge password []:
  23. An optional company name []:

4.在发送之前验证请求的内容

  1. $ openssl req -in www_csr.pem -text -verify -noout

5.将请求发送给startssl.com,从站点请求一个新的证书。当须要CSR的时候将'www_csr.pem'填进去

6.从网页上复制证书。然后放入'www_certificate.pem'文件,然后检查文件的内容:
  1. $ openssl x509 -in www_certificate.pem -text -noout

7.測试server证书

  1. $ openssl verify www_certificate.pem

假设都正确。那就会看到OK的提示

  1. www_certificate.pem: OK

怎样获取自己的SSL证书的更多相关文章

  1. 阿里云和腾讯云免费SSL证书 专题

    阿里云部署SSL证书 http://www.cnblogs.com/sslwork/p/5984167.html 查找中间证书 为了确保兼容到所有浏览器,我们必须在阿里云上部署中间证书,如果不部署证书 ...

  2. 实战申请Let's Encrypt永久免费SSL证书过程教程及常见问题

    最近需要https这里看到一份不错的博客,收录一下! Let's Encrypt作为一个公共且免费SSL的项目逐渐被广大用户传播和使用,是由Mozilla.Cisco.Akamai.IdenTrust ...

  3. 申请Let’s Encrypt永久免费SSL证书过程教程及常见问题

    配置证书https://easy.zhetao.com/   虽然目前Let’s Encrypt免费SSL证书默认是90天有效期,但是我们也可以到期自动续约,不影响我们的尝试和使用,为了考虑到文章的真 ...

  4. 转载免费的SSL证书

    目前我知道的有2种方式进行免费的SSL证书的获取 第一种:腾讯云申请 第二种:Let's Encrypt (国外在) 我一直使用第一种,还可以,有效期1年. 以下转载第二种: 实战申请Let's En ...

  5. ubuntu20.04 apache2 配置安装ssl证书

    1. 获取SSL证书 根据自己的网站服务器来获取不同的ssl证书,我的服务器是ubuntu20.04. 证书如下: 00_***.key ## 私钥文件 01_CERTIFICATE_***_***. ...

  6. centos7利用acme.sh获取Let's Encrypt的永久免费ssl证书并配置网站域名https访问

    acme.sh介绍:https://github.com/Neilpang/acme.sh/wiki/%E8%AF%B4%E6%98%8E github:https://github.com/Neil ...

  7. Let’s Encrypt Wildcard 免费泛域名SSL证书获取安装

    2018 年 1 月Let’s Encrypt CA 宣布免费提供通配符证书(Wildcard certificate).通配符证书是一种可被多个子域使用的公钥证书.这意味着,单个证书可用于提供多台服 ...

  8. docker获取Let's Encrypt永久免费SSL证书

    一 起因 官方的cerbot太烦了,不建议使用 还不如野蛮生长的acme.sh,而这里介绍docker运行cerbot获取Let's Encrypt永久免费SSL证书 二 选型 cerbot的证书不会 ...

  9. ubuntu 下获取Let's Encrypt免费ssl证书

    # ubuntu 下获取Let's Encrypt免费ssl证书 # 一.安装Nginx https://www.cnblogs.com/watermeloncode/p/15476317.html ...

随机推荐

  1. Android Studio安装教程

    Google在2013 I/O大会上发布Android Studio之后,广大Android开发者欢欣鼓舞,不过很快就有人出现问题,Android Studio无法安装,或者安装后无法启动,这篇文章就 ...

  2. -F, --flush-logs

    <pre name="code" class="html"> -F, --flush-logs Flush logs file in server ...

  3. spark论坛

    http://spark.apache.org/ http://bbs.csdn.net/forums/spark http://spark.csdn.net/ http://tieba.baidu. ...

  4. 重设mysql数据库root用户密码

     原文:http://blog.sina.com.cn/s/blog_a3695da601010mrs.html   1, 启用任务管理器,结束mysql进程   2,进入命令行,进入mysql的bi ...

  5. Java基础11 对象引用

    链接地址:http://www.cnblogs.com/vamei/archive/2013/04/01/2992484.html 作者:Vamei 出处:http://www.cnblogs.com ...

  6. Java基础08 继承

    作者:Vamei 出处:http://www.cnblogs.com/vamei 欢迎转载,也请保留这段声明.谢谢! 继承(inheritance)是面向对象的重要概念.继承是除组合(composit ...

  7. leetcode:Reverse Nodes in k-Group(以k为循环节反转链表)【面试算法题】

    题目: Given a linked list, reverse the nodes of a linked list k at a time and return its modified list ...

  8. Shell脚本笔记

      如何查询文件里的某个字符串? grep “字符串” 文件 例:grep "abc" tmp.txt   如何将查询出来的内容赋给变量? str=$(grep "abc ...

  9. 基于visual Studio2013解决C语言竞赛题之1010计算

         题目 解决代码及点评 /************************************************************************/ ...

  10. 前端project师,确定你的目标吧!无能的人才管他叫命运

    导语: 你为自己定过一个不靠谱的目标,是20年前的事了吧. 长大你想干什么?你的回答是什么?现在实现了吗? 如今,你每天都坐在同一个格子间的同一个电脑前,会不会感到每天都像是在复印,感到前途是模糊的, ...