1.首先要生成服务器端的私钥(key文件):
openssl genrsa -des3 -out server.key 1024
运行时会提示输入密码,此密码用于加密key文件
去除key文件口令的命令:
openssl rsa -in server.key -out server.key
2.openssl req -new -key server.key -out server.csr -config openssl.cnf
生成Certificate Signing Request(CSR),生成的csr文件交给CA签名后形成服务端自己的证书.屏幕上将有提示,依照其指示一步一步输入要求的个人信息即可.
3.对客户端也作同样的命令生成key及csr文件:
openssl genrsa -des3 -out client.key 1024
openssl req -new -key client.key -out client.csr -config openssl.cnf
4.CSR文件必须有CA的签名才可形成证书.可将此文件发送到verisign等地方由它验证.自己生成:
openssl req -new -x509 -keyout ca.key -out ca.crt -config openssl.cnf
5.用生成的CA的证书为刚才生成的server.csr,client.csr文件签名:
Openssl ca -in server.csr -out server.crt -cert ca.crt -keyfile ca.key -config openssl.cnf
Openssl ca -in client.csr -out client.crt -cert ca.crt -keyfile ca.key -config openssl.cnf
注意: 此时会出错:Using configuration from /usr/share/ssl/openssl.cnf I am unable to access the ./demoCA/newcerts directory ./demoCA/newcerts: No such file or directory
解决方法: 1).mkdir -p ./demoCA/newcerts
2).touch demoCA/index.txt
3).touch demoCA/serial
4).echo 01 > demoCA/serial
6.合并证书文件(crt)和私钥文件(key)
1).cat client.crt client.key > client.pem
2).cat server.crt server.key > server.pem
7.合并成pfx证书
1).openssl pkcs12 -export -clcerts -in client.crt -inkey client.key -out client.p12
2).openssl pkcs12 -export -clcerts -in server.crt -inkey server.key -out server.p12
8.文本化证书
1).openssl pkcs12 -in client.p12 -out client.txt
2).openssl pkcs12 -in server.p12 -out server.txt
9.屏幕模式显式:(证书、私钥、公钥)
1).openssl x509 -in client.crt -noout -text -modulus
2).openssl rsa -in server.key -noout -text -modulus
3).openssl rsa -in server.pub -noout -text -modulus
10.得到DH
1).openssl dhparam -out dh1024.pem 1024
(8) 编辑apache的配置文件httpd.conf
开启: LoadModule ssl_module modules/mod_ssl.so
去掉以下语句的注释, Include conf/extra/httpd-ssl.conf
# Secure (SSL/TLS) connections
Include conf/extra/httpd-ssl.conf
#
(9) 编辑 conf/extra/httpd-ssl.conf
<VirtualHost *:443>
SSLEngine On
SSLCertificateFile conf/ssl/server.crt
SSLCertificateKeyFile conf/ssl/server.key
SSLCertificateChainFile conf/ssl/ca.crt
</VirtualHost>
cd /usr/local/apache/conf
openssl genrsa -des3 -out server.key 1024
openssl req -new -key server.key -out server.csr -config /usr/local/ssl/openssl.cnf
openssl req -new -x509 -keyout ca.key -out ca.crt -config /usr/local/ssl/openssl.cnf
mkdir -p ./demoCA/newcerts
touch demoCA/index.txt
touch demoCA/serial
echo 01 > demoCA/serial
openssl ca -in server.csr -out server.crt -cert ca.crt -keyfile ca.key -config /usr/local/ssl/openssl.cnf
bin/apachectl start
分享到:
相关推荐
通过OpenSSL生成的ssl证书,用于windows下用nginx配置https服务器( OpenSSL创建证书) 无需再下载OpenSSL,配置OpenSSL相关环境,在进行命令生成证书
使用openssl生成证书,有详细的步骤说明,亲测可用。还有一些关于证书的一些常用转换操作介绍
使用openssl 在windows下生成https证书完整例子(附件文件里有openssl.cnf) 1.下载openssl 2.运行一下命令,生成密钥key 3.创建证书的申请文件 4.创建一个CA证书 5.使用上面的证书申请文件和CA证书,来创建自己...
NULL 博文链接:https://nassir.iteye.com/blog/1983613
最简单的方法,直接用java里的keytool工具生成一个keystore文件,然后直接用这个文件启用https就可以了。 方法如下: 命令行执行%JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA 执行过程中会询问你一些...
openssl和keytool都是生成https证书的工具,可以在windows上安装使用,附带一些操作说明,希望可以帮助大家
网络上很难找到非常详细的...本文档通过真实的实践经验,从安装OpenSSL和Nginx,到利用openssl生成证书,配置nginx的https(包括配置http请求转发到https)等,详细总结出nginx配置https的步骤,最终能帮助你配置成功。
这是我实战的笔记,全程直播。 #### Tomcat和Openssl...5、生成pem格式证书 6、生成pkcs12格式证书 二、tomcat实现双向认证 1、创建服务器信任的CA证书库 2、配置Tomcat支持HTTPS双向认证(服务器将认证客户端证书)
生成证书 通过keytool 和openssl,帮助在https环境下测试证书,但是此证书浏览器不认的
微软生成Https证书,可调时间限制。要为IIS开启https访问,需要先生成一个证书,openssl.net源码案例共享。证书格式通常是x509的数字证书的格式、还有pkcs等其他的。 对于x509这种证书内容当中都包含哪些呢: 1、...
OpenSSL创建生成CA证书、服务器、客户端证书及密钥,配套。https://blog.csdn.net/qq153471503/article/details/109524764
java实现的一个使用openssl生成crt证书的小工具,生成后动态修改nginx.conf文件,启用nginx中的https功能
openssl是当前非常流行的SSL密码库工具,如果服务器或者网站需要使用https协议,就需要使用openssl工具生成证书
OpenSSL安装包
这里说下Linux 系统怎么通过openssl命令生成 证书。 首先执行如下命令生成一个key
原文链接:https://blog.csdn.net/m0_37814112/article/details/119391879?spm=1001.2014.3001.5501 说明:一键生产nginx https自签证书脚本,真实有效!
Delphi使用CryptoAPI生成自签名证书,PHP端使用该证书进行签名,Delphi作为客户端使用公钥进行验签。
生成根证书 2.1 准备配置文件ca.conf 1.2 生成ca秘钥,得到ca.key openssl genrsa -out ca.key 4096 1.3 生成ca证书签发请求,得到ca.csr openssl req -new -sha256 -out ca.csr -key ca.key -config ca.conf ...
Win64OpenSSL-1_1_1e.msi windows安装包,在Windows系统生成https证书所需工具。
生成https所需要的OpenSSL安装程序以生成ssl安装证书文件