https访问如何生成本地证书

首先是HTTPS,我们知道使用HTTPS是需要证书的,所以接下来我们便制作一个证书。

1.使用JDK自带的工具keytool

keytool -genkey -alias caskeystore -keypass 123456 -keyalg RSA -keystore thekeystore

2.导出数字证书

keytool -export -alias caskeystore -keystore thekeystore -rfc -file cas.crt

 输入先前的密钥库口令,然后在当前目录下生成具体的cas.crt数字证书

3.将证书导入到JDK中,出现如下图表示导出成功。注:这里输入密码是JDK的,如果没有修改过密码为:changeit

1 keytool -import -alias caskeystore -keystore %JAVA_HOME%\jre\lib\security\cacerts -file cas.crt -trustcacerts -storepass changeit

(4)配置TOMCAT
    在tomcat目录下conf打开server.xml,找到84行,删除注释。
  

 修改前:
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
修改后:
<Connector port="8443" protocol="HTTP/1.1"
maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" 
keystoreFile="E:/cas/keys/cassso.keystore" keystorePass="123456"/>

注意:keystoreFile=证书存放的路径,keystorePass=生成证书时设置的密码

原文:https://blog.csdn.net/cl_andywin/article/details/53222858 




猜你喜欢

转载自www.cnblogs.com/walkingcamel/p/11134247.html