收藏 分享(赏)

制作和使用ssl证书.doc

上传人:马心欣 文档编号:21489322 上传时间:2023-11-28 格式:DOC 页数:6 大小:33.50KB
下载 相关 举报
制作和使用ssl证书.doc_第1页
第1页 / 共6页
制作和使用ssl证书.doc_第2页
第2页 / 共6页
制作和使用ssl证书.doc_第3页
第3页 / 共6页
亲,该文档总共6页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

1、制作和使用SSL证书在Linux环境下,一般都安装有OPENSSL。下面的内容就是用OPENSSL快速制作root证书以及客户端证书的步骤和方法。1、 初始准备工作1) 创建一个我们制作证书的工作目录# mkdir CA# cd CA# mkdir newcerts private2) 制作一个我们创建证书时需要的配置文件f,内容可以参考见# cd CA# vi f3) 创建我们自己的证书库的索引# echo 01 serial# touch index.txt2、 制作一个root证书执行下面的命令# openssl req -new -x509 -extensions v3_ca -key

2、out private/cakey.pem -out cacert.pem -days 3650 -config ./f在屏幕上会出现如下的交互内容,按照提示相应的信息。注意,一定要记住PEM,这个在以后生成客户端证书时都需要。Using configuration from ./fGenerating a 1024 bit RSA private key.+.+writing new private key to private/cakey.pemEnter PEM pass phrase:demoVerifying password - Enter PEM pass phrase:demo

3、-You 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

4、 field will be left blank.-Organization Name (company) The Sample Company:Organizational Unit Name (department, division) :CA DivisionEmail Address :caLocality Name (city, district) Metropolis:State or Province Name (full name) New York:Country Name (2 letter code) US:Common Name (hostname, IP, or y

5、our name) :TSC Root CA其中:-new -x509:表示创建一个自我签名的证书-extensions v3_ca:表示创建一个CA证书-days 3650:表示证书的有效期为10年。在root证书过期后,需要重新创建root证书和为所有客户提供的客户端证书以及为客户重新发布证书。这些工作量会很大。-keyout private/cakey.pem:指明root证书的Key文件-out cacert.pem:指明root证书文件-config ./f:表明用我们的配置文件命令执行完成后,会生成两个文件l 一个存放私钥Key的文件:private/cakey.pem l 一个r

6、oot CA证书文件:cacert.pem 可以分别用如下的命令来看证书的内容、有效期以及用途:# openssl x509 -in cacert.pem -noout -text# openssl x509 -in cacert.pem -noout -dates# openssl x509 -in cacert.pem -noout -purpose3、 制作一个CSR(Certificate Signing Request)执行下面的命令:# openssl req -new -nodes -out req.pem -config ./f在屏幕上会出现如下的交互内容,按照提示输入相应的信

7、息。.Organizational Unit Name (department, division) :Mail ServerEmail Address :postmasterCommon Name (hostname, IP, or your name) :.经过上面的命令,会有两个输出文件l 一个存放私钥Key的文件: key.pem l 一个CSR证书文件:req.pem 可以用下面的命令来看req.pem文件所包含的内容# openssl req -in req.pem -text -verify -noout注意:有关root证书的所以信息以及req证书的所有信息很关键,不能被删掉,

8、以免以后做客户端证书时有问题。4、 签名一个证书执行下面的命令openssl ca -out cert.pem -config ./f -infiles req.pem在屏幕上会出现如下的交互内容,按照提示输入相应的信息Using configuration from ./fEnter PEM pass phrase:demoCheck that the request matches the signatureSignature okThe Subjects Distinguished Name is as followsorganizationName :PRINTABLE:The Sam

9、ple CompanyorganizationalUnitName:PRINTABLE:Mail ServeremailAddress :IA5STRING:postmasterlocalityName :PRINTABLE:MetropolisstateOrProvinceName :PRINTABLE:New YorkcountryName :PRINTABLE:UScommonName :PRINTABLE:Certificate is to be certified until Dec 8 04:37:38 2002 GMT (365 days)Sign the certificate

10、? y/n:y1 out of 1 certificate requests certified, commit? y/nyWrite out database with 1 new entriesData Base Updated经过上面的命令,输出两个文件:l 一个客户端证书文件: cert.pem l 一个客户端证书的备份:newcerts/.pem 用下面的方法可以查看证书的内容# openssl x509 -in cert.pem -noout -text -purpose | more用下面的方法可以将证书内容改变为不可读的方式# mv cert.pem tmp.pem# openssl x509 -in tmp.pem -out cert.pem5、 证书的发布在提供给客户端时,需要提供如下的文件,客户需要将提供给他的证书保存在指定的目录下。l root证书:cacert.peml 客户端证书:cert.peml 制作CSR时生成的Key文件:key.pem

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高等教育 > 其他相关文档

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报