Centos生成SSL证书的步骤
1、yum install openssl安装openssl组件
2、生成KEY的流程步骤如下
1. 创建根证书密钥文件(自己做CA)root.key:
openssl genrsa -out root.key
输出内容为:
[lenin@archer ~]$ openssl genrsa -des3 -out root.key
Generating RSA private key, 512 bit long modulus
……………..++++++++++++
..++++++++++++
e is 65537 (0×10001)
2. 创建根证书的申请文件root.csr:
openssl req -new -key root.key -out root.csr
输出内容为:
[lenin@archer ~]$ openssl req -new -key root.key -out root.csr
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 []:admin@mycompany.com ← 电子邮箱,可随意填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.csr -out root.crt
输出内容为:
[lenin@archer ~]$ openssl x509 -req -days 3650 -sha1 -extensions v3_ca -signkey root.key -in root.csr -out root.crt
Getting Private key
subject=/C=CN/ST=BeiJing/L=BeiJing/O=MyCompany Corp./emailAddress=admin@mycompany.com
Signature ok
4. 创建服务器证书密钥server.key:
openssl genrsa -out server.key 2048
输出内容为:
[lenin@archer ~]$ openssl genrsa -out server.key 2048
Generating RSA private key, 2048 bit long modulus
….+++
…………………………………………..+++
e is 65537 (0×10001)
去除key文件口令的命令: openssl rsa -in server.key -out server.key
运行时会提示输入密码,此密码用于加密key文件(参数des3便是指加密算法,当然也可以选用其他你认为安全的算法.),以后每当需读取此文件(通过openssl提供的命令或API)都需输入口令.如果觉得不方便,也可以去除这个口令,但一定要采取其他的保护措施!
5.创建服务器证书的申请文件server.csr:
openssl req -new -key server.key -out server.csr
输出内容为:
[lenin@archer ~]$ openssl req -new -key server.key -out server.req
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) []:www.mycompany.com ← 服务器主机名,若填写不正确,浏览器会报告证书无效,但并不影响使用
Email Address []:admin@mycompany.com ← 电子邮箱,可随便填
An optional company name []: ← 可以不输入
A challenge password []: ← 可以不输入
to be sent with your certificate request
Please enter the following ‘extra’ attributes
6. 创建自当前日期起有效期为期十年的服务器证书server.crt:
openssl x509 -req -days 3650 -sha1 -extensions v3_req -CA root.crt -CAkey root.key -CAserial root.srl -CAcreateserial -in server.csr -out server.crt
输出内容为:
[lenin@archer ~]$ openssl x509 -req -days 3650 -sha1 -extensions v3_req -CA root.crt -CAkey root.key -CAserial root.srl -CAcreateserial -in server.csr -out server.crt
Getting CA Private Key
subject=/C=CN/ST=BeiJing/L=BeiJing/O=MyCompany Corp./CN=www.mycompany.com/emailAddress=admin@mycompany.com
Signature ok
7. 创建客户端证书密钥文件client.key:
openssl genrsa -out client.key 2048
输出内容为:
[lenin@archer ~]$ openssl genrsa -out client.key 2048
e is 65537 (0×10001)
……………………………………………………………………………………………………….+++
……………………………………………………………………………..+++
Generating RSA private key, 2048 bit long modulus
8. 创建客户端证书的申请文件client.csr:
openssl req -new -key client.key -out client.csr
输出内容为:
[lenin@archer ~]$ openssl req -new -key client.key -out client.csr
Enter pass phrase for client.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) []:Lenin ← 自己的英文名,可以随便填
Email Address []:admin@mycompany.com ← 电子邮箱,可以随便填
An optional company name []: ← 可以不填
A challenge password []: ← 可以不填
to be sent with your certificate request
Please enter the following ‘extra’ attributes
9. 创建一个自当前日期起有效期为十年的客户端证书client.crt:
openssl x509 -req -days 3650 -sha1 -extensions v3_req -CA root.crt -CAkey root.key -CAserial root.srl -CAcreateserial -in client.csr -out client.crt
输出内容为:
[lenin@archer ~]$ openssl x509 -req -days 3650 -sha1 -extensions v3_req -CA root.crt -CAkey root.key -CAcreateserial -in client.csr -out client.crt
Signature ok
subject=/C=CN/ST=BeiJing/L=BeiJing/O=MyCompany Corp./CN=www.mycompany.com/emailAddress=admin@mycompany.com
Getting CA Private Key
10. 将客户端证书文件client.crt和客户端证书密钥文件client.key合并成客户端证书安装包client.pfx:
openssl pkcs12 -export -in client.crt -inkey client.key -out client.pfx
输出内容为:
[lenin@archer ~]$ openssl pkcs12 -export -in client.crt -inkey client.key -out client.pfx
Enter Export Password: ← 输入一个新的密码,用作客户端证书的保护密码,在客户端安装证书时需要输入此密码
Verifying – Enter Export Password: ← 确认密码,可以为空密码
11. 保存生成的文件备用,其中server.crt和server.key是配置单向SSL时需要使用的证书文件,client.crt是配置双向SSL时需要使用的证书文件,client.pfx是配置双向SSL时需要客户端安装的证书文件
.crt文件和.key可以合到一个文件里面,把2个文件合成了一个.pem文件(直接拷贝过去就行了)
Centos生成SSL证书的步骤的更多相关文章
- 如何在 CentOS 7 上生成 SSL 证书为 Nginx 加密
本文首发:开发指南:如何在 CentOS 7 上安装 Nginx Let’s Encrypt 是由 Internet Security Research Group (ISRG) 开发的一个自由.自动 ...
- JDK自带工具keytool生成ssl证书
前言: 因为公司项目客户要求使用HTTPS的方式来保证数据的安全,所以木有办法研究了下怎么生成ssl证书来使用https以保证数据安全. 百度了不少资料,看到JAVA的JDK自带生成SSL证书的工具: ...
- 使用openssl生成SSL证书完全参考手册
一般来说,配置HTTPS/SSL的步骤为: 1.生成足够强度的私钥.需要考虑:算法,广泛采用的一般是RSA.键长度,RSA默认为512,一般应选择2048.密码,虽然私钥不一定要加密存储,但是加密存储 ...
- openssl生成ssl证书
openssl生成ssl证书 x509证书一般会用到三类文,key,csr,crt. Key 是私用密钥openssl格,通常是rsa算法. Csr 是证书请求文件,用于申请证书.在制作csr文件的时 ...
- 生成ssl证书文件
网上关于生成SSL证书文件的方法有很多,但我查了几个,发现有或多或少的错误,如下我图文并茂的展示,亲测无任何问题,分享给大家,谢谢. 1.创建根证书密钥文件(自己做CA)root.key openss ...
- 用 letsencrypt 生成 SSL 证书
letsencrypt 生成 SSL 证书 事先配置好访问域名解析 在nginx 对应虚拟主机添加一个验证区域: 配置 nginx server { listen 80; ... location ~ ...
- 使用keytool生成ssl证书
使用keytool生成ssl证书 在项目中由于要使用https访问项目,然后了解到jdk有一个自带的工具keytool可以用来生成ssl证书,从而可以通过https进行访问. 使用keytool生成s ...
- 用XCA(X Certificate and key management)可视化程序管理SSL 证书(2)--生成SSL证书请求
在上个章节中,我们提到了怎样安装XCA(X Certificate and key management)程序.这个章节我们開始正式介绍怎样用XCA生成证书请求.假设大家用过java的话.肯定知道jd ...
- openssl生成SSL证书的流程
SSL证书通过在客户端浏览器和Web服务器之间建立一条SSL安全通道(Secure socketlayer(SSL),SSL安全协议主要用来提供对用户和服务器的认证:对传送的数据进行加密和隐藏:确保数 ...
随机推荐
- ZOJ 1276 Optimal Array Multiplication Sequence(矩阵连乘)
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1276 裸的矩阵连乘问题. #include<iostream> ...
- 谷歌开发者工具(F12)的使用小坑
python模拟登陆知乎,用开发者工具跟踪浏览器与服务器的交互,需要知道用户名,密码的字段名,可在文件email中看到:需要注意的是一定要 勾选 preserve log ,否则登陆之前的交互不会显示 ...
- Curious Array CodeForces - 407C (高阶差分)
高阶差分板子题 const int N = 1e5+111; int a[N], n, m, k; int C[N][111], d[N][111]; signed main() { scanf(&q ...
- React中使用UEditor
一般UEditor用于表单的新建和编辑 <FormItem {...formItemLayout} label='商品详情'> {getFieldDecorator('detail', { ...
- java--Quartz 定时执行
第一步:引包(Maven) <!-- 定时任务 --> <dependency> <groupId>org.quartz-scheduler</groupId ...
- 如何使用Win8系统自带杀毒软件
首先我们要说明的是,Windows Defender并不是我们杀毒首选,这只是微软在用户没有安装仍和杀软时提供的备用防护机制.因此我们如果安装了第三方的杀毒软件,系统就会将Windows Defend ...
- [svc]线上Iptables重启报错
线上iptables重启了下发现报错,排查了下 [root@xxxx ~]# /etc/init.d/iptables restart iptables: Setting chains to poli ...
- DOM之概述
body, table{font-family: 微软雅黑; font-size: 10pt} table{border-collapse: collapse; border: solid gray; ...
- L192 Virgin Galactic Completes Test of Spaceship to Carry Tourists
Virgin Galactic says its spacecraft designed to launch tourists into space completed an important te ...
- # 20155327 2016-2017-4 《Java程序设计》第8周学习总结
20155327 2016-2017-4 <Java程序设计>第7周学习总结 教材学习内容总结 了解NIO NIO使用频道(Channel)来衔接数据节点,在处理数据时,NIO可以让你设定 ...