首页 > IT基础架构 > 网络安全 > Pfx文件与单向SSL配置
Pfx文件与单向SSL配置
pfx是什么文件
公钥加密技术12号标准(Public Key Cryptography Standards #12,PKCS#12)为存储和传输用户或服务器私钥、公钥和证书指定了一个可移植的格式。它是一种二进制格式,这些文件也称为PFX文件。开发人员通常需要将PFX文件转换为某些不同的格式,如PEM或JKS,以便可以为使用SSL通信的独立Java客户端或WebLogic Server使用。是一种Microsoft协议,使得用户可以将机密信息从一个环境或平台传输到另一个环境或平台。使用该协议,用户就可以安全地将个人信息从一个计算机系统导出到另一个系统中。
单向SSL配置
生成 SSL证书命令:
sudo keytool -genkey -keyalg RSA -dname “cn=localhost,ou=none,o=none,l=shanghai,st=shanghai,c=cn” -alias server -keypass 123456 -keystore server.keystore -storepass 123456 -validity 3650
生成CSR文件
sudo keytool -certReq -alias server -keystore server.keystore -file ca.csr -storepass 123456
生成CER文件
sudo keytool -export -alias server -keystore server.keystore -file ca.cer -storepass 123456
在Tomcat中配置Https证书
在serve.xml 中添加如下配置,即可访问https的站点了。
<Connector SSLEnabled=”true” clientAuth=”false”
keystoreFile=”/Users/beiyan/Documents/test/server.keystore”
keystorePass=”123456″ maxThreads=”150″ port=”8443″
protocol=”org.apache.coyote.http11.Http11NioProtocol” scheme=”https”
secure=”true” sslProtocol=”TLS” />
其中keystoreFile 为证书的地址,keystorePass 为证书的密码。
访问界面如下:

导入CER文件,让浏览器信任此证书

应用程序访问
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/31483669/viewspace-2678421/ ,如需转载,请注明出处,否则将追究法律责任。