具有主题备用名称的证书的PKIX路径构建失败

时间:2016-09-08 08:03:45

标签: java ssl certificate truststore subject-alternative-name

我正在尝试访问我的java Web应用程序中的安全地址。应用程序在带有java7的tomcat7上运行,我使用以下命令启动了tomcat:

-Djavax.net.ssl.trustStore=path-to-truststore.jks -Djavax.net.ssl.trustStorePassword=mypass

我的信任库包含一些针对不同站点的可信证书,并且它们都正常工作,除了其中一个证书中的哪个站点地址被定义为SAN(使用者备用名称)扩展字段。例如,证书颁发给my-site1.com,它有一个SAN字段到my-site2.com,我需要在我的JavaEE应用程序中访问my-site2.com。 这是我得到的例外:

javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
    at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1884)
    at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:276)
    at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:270)
    at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1341)
    at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:153)
    at sun.security.ssl.Handshaker.processLoop(Handshaker.java:868)
    at sun.security.ssl.Handshaker.process_record(Handshaker.java:804)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1016)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1312)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1339)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1323)
    at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:563)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
    at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1091)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:250)
    ...

有什么建议吗?

0 个答案:

没有答案