使用openssl工具生成证书
第一步. 生成rsa私钥文件
:\> openssl genrsa -out bexio.pem 1024
: 若要加密生成的rsa私钥文件(des3加密)
:\> openssl genrsa -des3 -out bexio.pem 1024
第二步. 生成Certificate Signing Request(CSR - 证书请求文件)
:\> openssl req -new -key bexio.pem -out bexio.csr -config openssl.cnf
: 根据交互提示一步一步输入必要信息, 敲击回车可以跳过, 以下是一个简单的例子
Country Name (2 letter code) [AU]:CN
State or Province Name (full name) [Some-State]:china
Locality Name (eg, city) []:xiamen
Organization Name (eg, company) [Internet Widgits Pty Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (e.g. server FQDN or YOUR name) []:
Email Address []:289633152@qq.com
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
第三步. 把证书请求文件认证为可用证书
(1) 生产CA根证书(用于签名)
: 把openssl.cnf复制到openssl.exe所在目录
:\> openssl req -new -x509 -keyout ca.key -out ca.crt -config openssl.cnf
执行成功以后, 在oepnssl所在目录便生成了ca.key和ca.crt两个文件. 其中ca.key存的是CA根证书的私钥, ca.crt存的便是CA根证书.
(2) 准备CA环境
: 把openssl.cnf复制到openssl.exe所在目录, 修改其中的ca section, 添加新的ca策略. 如下:
####################################################################
[ ca ]
default_ca = CA_BEXIO #CA_default # The default ca section
####################################################################
[ CA_BEXIO ]
dir = .# Where everything is kept
certs = $dir# Where the issued certs are kept
crl_dir = $dir# Where the issued crl are kept
database = $dir/index.txt# database index file.
new_certs_dir = $dir# default place for new certs.
certificate = $dir/ca.crt# The CA certificate
serial = $dir/serial# The current serial number
crlnumber = $dir/crlnumber# the current crl number
# must be commented out to leave a V1 CRL
crl = $dir/crl.pem# The current CRL
private_key = $dir/ca.key# The private key
RANDFILE = $dir/.rand# private random number file
x509_extensions = usr_cert# The extentions to add to the cert
# Comment out the following two lines for the "traditional"
# (and highly broken) format.
name_opt = ca_default# Subject Name options
cert_opt = ca_default# Certificate field options
# Extension copying option: use with caution.
# copy_extensions = copy
# Extensions to add to a CRL. Note: Netscape communicator chokes on V2 CRLs
# so this is commented out by default to leave a V1 CRL.
# crlnumber must also be commented out to leave a V1 CRL.
# crl_extensions = crl_ext
default_days = 3650# how long to certify for
default_crl_days= 30# how long before next CRL
default_md = default# use public key default MD
preserve = no# keep passed DN ordering
# A few difference way of specifying how similar the request should look
# For type CA, the listed attributes must be the same, and the optional
# and supplied fields are just that :-)
policy = policy_anything
: 生成证书索引文件和数据库文件
\Linux:
$ touch index.txt
$ echo 01> serial
\Windows:
:\> copy con index.txt
:\> <Ctrl-z>
:\> echo 01> serial
: 修改openssl.cnf中的配置项如下:
[ policy_anything ]
countryName = optional
stateOrProvinceName = optional
localityName = optional
organizationName = optional
organizationalUnitName = optional
commonName = optional
emailAddress = optional
(3) CA签名
:\> openssl ca -in bexio.csr -out bexio.crt -config openssl.cnf
至此, 生成的证书相关文件有: ca.crt (ca根证书) bexio.pem(私钥) bexio.crt(证书)
在使用时, 私钥和证书可以合并为一个文件.
\Linux:
$ cat bexio.pem >> bexio.crt
\Windows:
用文本编辑器把内容拷贝过去即可
使用openssl工具生成证书的更多相关文章
- 如何使用OpenSSL工具生成根证书与应用证书
如何使用OpenSSL工具生成根证书与应用证书 一.步骤简记 // 生成顶级CA的公钥证书和私钥文件,有效期10年(RSA 1024bits,默认) openssl req -new -x509 -d ...
- tomcat配置https–采用JDK自带的keytool工具生成证书
转自:http://blog.csdn.net/huangxinyu_it/article/details/41693633 有关http与https的区别请看<浅谈http与https的区别( ...
- openssl req(生成证书请求和自建CA)(转)
openssl req(生成证书请求和自建CA) 伪命令req大致有3个功能:生成证书请求文件.验证证书请求文件和创建根CA.由于openssl req命令选项较多,所以先各举几个例子,再集中 ...
- openssl req(生成证书请求和自建CA)
伪命令req大致有3个功能:生成证书请求文件.验证证书请求文件和创建根CA.由于openssl req命令选项较多,所以先各举几个例子,再集中给出openssl req的选项说明.若已熟悉openss ...
- openssl基本原理 + 生成证书 + 使用实例
前期准备 : 安装xampp:打开文件E:\xampp\apache\bin\openssl.exe 右键 以管理员身份运行 ------转载自 https://blog.csdn.net/oldm ...
- 使用JDK自带的keytool工具生成证书
一.keytool 简介 keytool 是java用于管理密钥和证书的工具,它使用户能够管理自己的公钥/私钥对及相关证书,用于(通过数字签名)自我认证(用户向别的用户/服务认证自己)或数据完整性以及 ...
- 使用openssl工具生成密钥
下载Openssl工具 进入OpenSSL工具,输入以下命令. OpenSSL> genrsa - #生成私钥 OpenSSL> pkcs8 -topk8 -inform PEM -in ...
- Linux 部署Nginx反向代理服务 使用openssl自生成证书并配置https
1.安装Nginx编译所依赖的包 正常centos中可以使用yum安装一下依赖包: yum install -y gcc gcc-c++ pcre pcre-devel zlib zlib-devel ...
- 如何用java自带的工具生成证书
一.keytool的概念 keytool 是个密钥和证书管理工具.它使用户能够管理自己的公钥/私钥对及相关证书,用于(通过数字签名)自我认证(用户向别的用户/服务认证自己)或数据完整性以及认证服务.在 ...
随机推荐
- 关系数据库&&NoSQL数据库
在过去,我们只需要学习和使用一种数据库技术,就能做几乎所有的数据库应用开发.因为成熟稳定的关系数据库产品并不是很多,而供你选择的免费版本就更加少了,所以互联网领域基本上都选择了免费的MySQL数据库. ...
- Scrum之Sprint物件
产品订单(Product Backlog) 一个需求的列表. 一般情况使用用户故事来表示backlog条目 理想情况每个需求项都对产品的客户或用户有价值 Backlog条目按照商业价值排列优先级 优先 ...
- 分区表,桶表,外部表,以及hive一些命令行小工具
hive中的表与hdfs中的文件通过metastore关联起来的.Hive的数据模型:内部表,分区表,外部表,桶表受控表(managed table):包括内部表,分区表,桶表 内部表: 我们删除表的 ...
- Redhat=》中文
我的redhat安装时没有提示语言选项,由于工程需要,支持汉字是不可避免的,因此就必须安装中文输入法. 安装中文包 将系统光盘镜像文件连接至计算机,我的镜像是RHEL5.1的,先将光盘挂载至/mnt目 ...
- JVM系列二:GC策略&内存申请、对象衰老
JVM里的GC(Garbage Collection)的算法有很多种,如标记清除收集器,压缩收集器,分代收集器等等,详见HotSpot VM GC 的种类 现在比较常用的是分代收集(generatio ...
- USB的四种传输类型
USB协议规定了4种传输类型:批量(bulk)传输,等时传输(同步传输),中断传输和控制传输.
- 【转贴】Linux系统NGINX负载均衡404错误处理方法
NGINX负载均衡404错误处理方法 使用NGINX 实现负载均衡,但一组服务器的数据不是实施同步,主服务器有了数据要过段时间才同步到其他服务器 upstream image.stream.com ...
- HTTP 错误 405.0 - Method Not Allowed
如果A页面通过表单(form)向B页面传递参数,而B页面是以“.htm or .html ”为扩展名的话,通过IIS解析会出现“HTTP 错误 405 -禁止访问资源”错误的提示. 原因:IIS解析文 ...
- sql 无法识别的配置节 system.serviceModel
sql 链接实例的时候,提示 无法识别的配置节 system.serviceModelC:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\mac ...
- EASYUI DATAGRID 多列复选框CheckBox
主要实现: 用的 easyui 1.3.2 实现多个复选框列,各列互不影响.能够实现全选.主要部门用红色标记了的. easyui datagrid 初始化: <script> functi ...