使用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 是个密钥和证书管理工具.它使用户能够管理自己的公钥/私钥对及相关证书,用于(通过数字签名)自我认证(用户向别的用户/服务认证自己)或数据完整性以及认证服务.在 ...
随机推荐
- Raspberry Pi上手
2013-05-21 买的树莓派终于到手了,嘿嘿.我在官方代理ICKEY买的,是英国版,B型. 上手教程可以根据Getting Started with Raspberry Pi(网上有电子版免费下载 ...
- 【boost】BOOST_LOCAL_FUNCTION体验
c++11里支持使用lambda在函数内定义本地嵌套函数,将一些算法的判断式定义为本地函数可以使代码更加清晰,同时声明和调用靠近也使得更容易维护.遗憾的是公司开发平台任然停留在vs2008,使用boo ...
- 本人为项目组制定的一份页面优化指南(easyui页面优化方案)
#本人为项目组制定的一份页面优化指南(easyui页面优化方案) ##背景 这是一篇我之前为项目组制定的页面优化指南,主要是面向表单页面,典型的像[注册用户](https://passport.cnb ...
- 基于MapReduce的关系代数运算(2)
1.自然连接 Map函数:对于R中的每个元组(a,b),生成键值对(b,(R,a)),对于S中的每个元组(b,c),生成键值对(b,(S,c)) Reduce函数:每个键值b会与一系列对相关联,这些对 ...
- (window)Android Studio安装以及Fetching android sdk component information超时的解决方案
转自:http://www.cnblogs.com/sonyi/p/4154797.html 在经过两年的开发之本后,Google 公司终于发布了 Android Studio 1.0,喜欢折腾的童鞋 ...
- flask中的session对象方法
'clear', 'copy', 'fromkeys', 'get', 'has_key', 'items', 'iteritems', 'iterkeys', 'itervalues', 'keys ...
- C++中使用接口
面向对象的语言诸如JAVA提供了Interface来实现接口,但C++却没有这样一个东西,尽管C++ 通过纯虚基类实现接口,譬如COM的C++实现就是通过纯虚基类实现的(当然MFC的COM实现用了嵌套 ...
- jdbc调用存储过程的方法
----------------------------jdbc调用存储过程的方法---------------------------------------------------private ...
- 可以binidng属性的属性【项目】
1:binding后台bool[]数据以及后台ObservableCollection数据 分别见下面xaml的Visibility和Text的Binding public bool[] Rubber ...
- Java的初步认识
PS:弥补那些错过的时间,弥补那些本是决定做而没有做的事情,当初说好了学习编程要把自己学到的或是理解的写到博客中记录下来,可是由于各种缘由最终是没有实现...经过几番周折决定把那些丢掉的重新捡起来.对 ...