本人运行环境:openssl-1.0.1p,vs2010
首先运行CMD,跳转到..\openssl-1.0.1p\out32dll 目录下,比如我的:
c:>cd c:\openssl-1.0.1p\out32dll
c:\openssl-1.0.1p\out32dll
然后依次执行下面的步骤,生成对应的文件:
1.首先要生成服务器端的私钥(key文件):
openssl genrsa -des3 -out server.key 1024运行时会提示输入密码,此密码用于加密key文件(参数des3便是指加密算法),以后每当需读取此文件,输入密码后还要确认一下,输两遍。
去除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签名后形成服务端自己的证书.
这个地方有可能会报如下错误:
WARNING: can't open config file: /usr/local/ssl/openssl.cnf
error on line -1 of openssl.cnf
9748:error:02001002:system library:fopen:No such file or directory:.\crypto\bio\
bss_file.c:168:fopen('openssl.cnf','rb')
9748:error:2006D080:BIO routines:BIO_new_file:no such file:.\crypto\bio\bss_file
.c:171:
9748:error:0E078072:configuration file routines:DEF_LOAD:no such file:.\crypto\c
onf\conf_def.c:195:
具体的解决方法参考文章:http://www.vcerror.com/?p=2027
运行成功,屏幕会提示一步一步输入个人信息: