我使用 keytool 创建了一个证书:
keytool -genkey -alias tomcat -keyalg RSA
将其导出并导入我的密钥库:
keytool -export -alias tomcat name.crt
keytool -import -file name.crt
当我执行 keytool -list 时,我有 2 个条目:
tomcat, Sept 15, 2010, keyEntry,
Certificate fingerprint (MD5): ...
mykey, Sept 17, 2010, trustedCertEntry
Certificate fingerprint (MD5):...
请注意,两个条目的指纹是相同的。
我将 server.xml 配置为指向我的 .keystore 文件
<Connector port="443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
keystoreFile="${user.home}/.keystore" keystorePass="changeit"
clientAuth="false" sslProtocol="TLS" />
<Connector port="8009" protocol="AJP/1.3" redirectPort="443" />
但是在我的 tomcat 日志中,我看到当我在我的 Java 应用程序中执行一个操作时:
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found
...
sun.security.validator.ValidatorException: No trusted certificate found
还有其他需要做的配置吗?