本文主要讲述使用openssl来生成ecdsa证书和RSA证书。
首先在openssl官网上下载openssl源码,然后进行编译安装。
这个过程本文不进行讲解。默认你的系统中已经安装好了openssl。
但是需要使用下载的源码。
本文中的代码等都是实测可用的。使用平台是linux,版本是ubuntu14.04
下面开始正文。
以下linux命令均在root用户下完成。
1、首先要创建一个CA
创建CA的方法是进去openssl的源码目录下的app/文件夹下。然后输入创建CA命令:
root@mzq-desktop:/home/mzq# cd Desktop/openssl-1.0.1j_mzq1/apps/
root@mzq-desktop:/home/mzq/Desktop/openssl-1.0.1j_mzq1/apps# sh CA.sh -newca
2、生成RSA密钥
生成rsa密钥使用命令openssl genrsa
root@mzq-desktop:/home/mzq/Desktop/openssl-1.0.1j_mzq1/apps# openssl genrsa -out server.key 2048
Generating RSA private key, 2048 bit long modulus
...................+++
.........................+++
e is 65537 (0x10001)
3、生成ECDSA密钥
生成ecdsa密钥使用命令openssl ecparam
root@mzq-desktop:/home/mzq/Desktop/openssl-1.0.1j_mzq1/apps# openssl ecparam -name secp384r1 -genkey -out server-ecc.key
3、生成证书请求
生成证书请求使用命令openssl req
RSA证书请求:
root@mzq-desktop:/home/mzq/Desktop/openssl-1.0.1j_mzq1/apps# openssl req -new -key server.key -out server.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
State or Province Name (full name) [Some-State]:beijing
Locality Name (eg, city) []:beijing
Organization Name (eg, company) [Internet Widgits Pty Ltd]:dcs
Organizational Unit Name (eg, section) []:dcs
Common Name (e.g. server FQDN or YOUR name) []:mzq
Email Address []:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
ECDSA证书请求:
root@mzq-desktop:/home/mzq/Desktop/openssl-1.0.1j_mzq1/apps# openssl req -new -key server-ecc.key -out server-ecc.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
State or Province Name (full name) [Some-State]:beijing
Locality Name (eg, city) []:beijing
Organization Name (eg, company) [Internet Widgits Pty Ltd]:dcs
Organizational Unit Name (eg, section) []:dcs
Common Name (e.g. server FQDN or YOUR name) []:mzq
Email Address []:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
4、签发证书
签发证书使用openssl ca命令
RSA证书:
root@mzq-desktop:/home/mzq/Desktop/openssl-1.0.1j_mzq1/apps# openssl ca -in server.csr -out server.crt -days 3650
Using configuration from /usr/local/ssl/openssl.cnf
Check that the request matches the signature
Signature ok
The countryName field needed to be the same in the
CA certificate (AU) and the request (CN)
ECDSA证书:
root@mzq-desktop:/home/mzq/Desktop/openssl-1.0.1j_mzq1/apps# openssl ca -in server-ecc.csr -out server-ecc.crt -days 3650
Using configuration from /usr/local/ssl/openssl.cnf
Check that the request matches the signature
Signature ok
The countryName field needed to be the same in the
CA certificate (AU) and the request (CN)
这样,证书就申请成功了。可以对证书进行使用。
相关推荐
通过OpenSSL生成的ssl证书,用于windows下用nginx配置https服务器( OpenSSL创建证书) 无需再下载OpenSSL,配置OpenSSL相关环境,在进行命令生成证书
使用openssl生成证书,有详细的步骤说明,亲测可用。还有一些关于证书的一些常用转换操作介绍
linux下openssl中非对称加密算法RSA的16进制密钥生成方法
1.安装OpenSSL(Win32) 0.9.8l解压压缩包, 双击exe文件:选择安装路径:选择工具安装位置:安装中:安装完成:2.生成RSA密钥进入Open
使用openssl生成单向ssl证书,此方法生成的证书可以用于基于boost.asio库的SSL通讯测试中。基于基于boost.asio库SSL通讯测试程序可参见本人其他资源。
OpenSSL 证书生成器 可用于apache的ssl证书生成
openssl生成RSA私钥公钥,该压缩包包含详细的使用说明及DEMO
利用openssl生成CA证书的方法及证书,根据文档可以自己生成证书。
使用openssl生成RSA密钥对
RSA算法C++程序,采用了openssl
使用openssl生成RSA秘钥对
2.该程序具有生成RSA密钥对、RSA公钥加密和RSA私钥解密的功能,支持手动输入密钥; 3.该程序支持不限长度的明文加密,支持256~4096长度的密钥,支持Crypto++密码库生成的RSA密钥对(公钥:X.509,私钥:PKCS#8); 4...
命令: openssl genrsa -out rsa_private_key.pem 1024 openssl pkcs8 -topk8 -inform PEM -in rsa_private_key.pem -outform PEM -nocrypt -...openssl rsa -in rsa_private_key.pem -pubout -out rsa_public_key.pem
基于OpenSSL库的ECDSA签名与验证,实现了密钥对生成导出,数据的签名以及签名的验证。仅供参考。附代码和文档
rsa test加密解密程序使用openssl
1、生成密钥对 2 2、导出私钥 2 3、导出公钥 3 4、生成密钥源代码 3 1、导入私钥 8 2、数据签名 8 3、数据签名源代码 8 1、导入公钥 14
ecdsa 算法实现 通过openssl 实现
包含OpenSSL和GMSSL生成证书命令,RSA证书和SM2证书的生成方式
openssl生成的证书demo,包含CA以及CA签名的client、server,为了安全起见,请勿将其用于生产环境
Qt利用OpenSSl实现RSA数字签名 http://blog.csdn.net/usister/article/details/74390949资源描述 欢迎评论