- 1、本文档共6页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
OpenSSL操作步骤
OpenSSL实践
切换到/etc/pki/CA/目录
创建CA私钥openssl genrsa -out private/ca.key 1024
加密CA私钥(保护私钥信息)openssl rsa -in ca.key -out cakey.pem
创建CA自签名证书(使用上一步创建的CA私钥来签名)penssl req -new -days 365 -x509 -key private/ca.key -out cacert.pem
创建服务器私钥openssl genrsa -des3 -out private/server.key 1024
加密服务器私钥(保护私钥信息)openssl rsa -in private/server.key -out private/serverkey.pem
创建申请服务器所需证书的请求openssl req -new -days 365 -key server.key -out server.csr
CA私钥和序列号文件demoCA/serial, demoCA/index.txtmkdir certs crl newcerts
touch index.txt serial
echo 01 serial
CA签署服务器证书openssl ca -days 365 -keyfile private/ca.key -cert cacert.pem -outdir ./ -in server.csr -out server.pem
转换格式openssl x509 -in server.pem -out certs/server.crt
openssl x509 -in cacert.pem -out certs/cacert.crt
产生Java客户端私钥文件keytool -genkey -keyalg RSA -alias ztyHotelService -keystore ztyHotelService.jks -storepass f1l89rmy -storetype jks
产生Java客户端证书请求keytool -certreq -alias ztyHotelService -keyalg RSA -file ztyHotelService.csr -keystore ztyHotelService.jks
CA签署Java客户端证书openssl ca -days 365 -keyfile private/ca.key -cert cacert.pem -outdir ./ -in ztyHotelService.csr -out ztyHotelService.pem
转换格式openssl x509 -in ztyHotelService.pem -out certs/ztyHotelService.cer
导入CA证书到jks文件并信任之(由此CA所签署的所有证书也因此在信任之列):
keytool -import -alias root -trustcacerts -file certs/cacert.crt -keystore ztyHotelService.jks
导入自己的证书到jks文件(至此,此jks文件包括了建立SSL连接所需所有信息)keytool -import -alias ztyHotelService -trustcacerts -file certs/ztyHotelService.cer -keystore ztyHotelService.jks
转换成pkcs12格式,为客户端安装所用openssl pkcs12 -export -clcerts -in client.crt -inkey client.key -out client.pfx
错误信息
服务器私钥密码输入错误:
文档评论(0)