Openssl安装_openssl安装教程

Openssl安装_openssl安装教程因为生成keystore文件需要用到openssl命令,简单记录下windows下 openssl安装和配置过程1.直接从官网下载exe下载地址:http://slproweb.com/products/Win32OpenSSL.html,下载完成后直接安装,可以安装到任意目录2.配置环境变量打开系统属性-高级系统设置-环境变量,在系统变量中新建一个系统变量,变量名为OPE...

因为生成keystore文件需要用到openssl 命令,简单记录下windows下 openssl安装和配置过程

1. 直接从官网下载exe

下载地址:http://slproweb.com/products/Win32OpenSSL.html,下载完成后直接安装,可以安装到任意目录

2. 配置环境变量

打开 系统属性-高级系统设置-环境变量,在系统变量中新建一个系统变量,变量名为OPENSSL_HOME,变量值为 openssl安装目录\bin,我的路径是D:\Program Files\OpenSSL-Win64\bin

Openssl安装_openssl安装教程

3. 这时候在cmd运行openssl,会出现cannot open config file /usr/local/ssl/openssl.cnf

网上看到的其他教程,是直接配置openssl.cnf,但是我的安装目录并没有openssl.conf这个文件,这时候就要自己手动创建一下

Openssl安装_openssl安装教程

文件内容可以直接复制下面的:

#
# OpenSSL configuration file.
#

# Establish working directory.

dir                 = .

[ ca ]
default_ca              = CA_default

[ CA_default ]
serial                  = $dir/serial
database                = $dir/certindex.txt
new_certs_dir               = $dir/certs
certificate             = $dir/cacert.pem
private_key             = $dir/private/cakey.pem
default_days                = 365
default_md              = md5
preserve                = no
email_in_dn             = no
nameopt                 = default_ca
certopt                 = default_ca
policy                  = policy_match

[ policy_match ]
countryName             = match
stateOrProvinceName         = match
organizationName            = match
organizationalUnitName          = optional
commonName              = supplied
emailAddress                = optional

[ req ]
default_bits                = 1024          # Size of keys
default_keyfile             = key.pem       # name of generated keys
default_md              = md5               # message digest algorithm
string_mask             = nombstr       # permitted characters
distinguished_name          = req_distinguished_name
req_extensions              = v3_req

[ req_distinguished_name ]
# Variable name             Prompt string
#-------------------------    ----------------------------------
0.organizationName          = Organization Name (company)
organizationalUnitName          = Organizational Unit Name (department, division)
emailAddress                = Email Address
emailAddress_max            = 40
localityName                = Locality Name (city, district)
stateOrProvinceName         = State or Province Name (full name)
countryName             = Country Name (2 letter code)
countryName_min             = 2
countryName_max             = 2
commonName              = Common Name (hostname, IP, or your name)
commonName_max              = 64

# Default values for the above, for consistency and less typing.
# Variable name             Value
#------------------------     ------------------------------
0.organizationName_default      = My Company
localityName_default            = My Town
stateOrProvinceName_default     = State or Providence
countryName_default         = US

[ v3_ca ]
basicConstraints            = CA:TRUE
subjectKeyIdentifier            = hash
authorityKeyIdentifier          = keyid:always,issuer:always

[ v3_req ]
basicConstraints            = CA:FALSE
subjectKeyIdentifier            = hash

然后在系统变量中新增OPEN_CONF,值是conf文件路径

Openssl安装_openssl安装教程

4. 这时候在cmd运行openssl还会出现cannot open config file /usr/local/ssl/openssl.cnf

在cmd下输入 set OPENSSL_CONF=D:\Program Files\OpenSSL-Win64\bin\openssl.cnf 就可以了

 

本文来源WeLoveSunFlower,由架构君转载发布,观点不代表Java架构师必看的立场,转载请标明来源出处:https://javajgs.com/archives/222812
0
 

发表评论