主机名与对等方提供的证书主题不匹配

时间:2018-05-09 06:52:59

标签: java ssl https apache-httpclient-4.x

小写

中未提供域名时,会发现以下异常
   Error: Host name 'machine1.mydomain.COM' does not match the certificate subject provided by the peer (CN=machine1.MYDOMAIN.COM, OU=TEAM, O=DD, L=DD, ST=MP, C=IN)
javax.net.ssl.SSLPeerUnverifiedException: Host name 'machine1.mydomain.COM' does not match the certificate subject provided by the peer (CN=machine1.MYDOMAIN.COM, OU=TEAM, O=DD, L=DD, ST=MP, C=IN)
    at org.apache.http.conn.ssl.SSLConnectionSocketFactory.verifyHostname(SSLConnectionSocketFactory.java:465)
    at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:395)
    at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:353)
    at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:141)
    at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
    at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
    at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
    at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
    at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
    at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
    at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:107)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)     

有没有办法摆脱这种情况并允许不区分大小写的域。

*注意:机器名称" machine1"在任何情况下都有效;不区分大小写的

jar版:httpclient-4.5.2.jar

0 个答案:

没有答案