0
在IBM RSA中創建Web服務客戶端時,出現異常。「Exception:javax.net.ssl.SSLHandshakeException:java.security.cert.CertificateException:No subject alternative DNS名稱匹配「java.security.cert.CertificateException:
請告知如何解決此問題。
謝謝,
在IBM RSA中創建Web服務客戶端時,出現異常。「Exception:javax.net.ssl.SSLHandshakeException:java.security.cert.CertificateException:No subject alternative DNS名稱匹配「java.security.cert.CertificateException:
請告知如何解決此問題。
謝謝,
您需要將SSL證書從服務器安裝到客戶機。 注意如果SSL證書selft簽名,你需要禁用這樣的SSL檢查:
static {
javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(new javax.net.ssl.HostnameVerifier() {
public boolean verify(String hostname, javax.net.ssl.SSLSession sslSession) {
//for localhost or same LAN
if (hostname.equals("localhost") || hostname.startsWith("192.168")) {
return true;
}
return false;
}
});
}
注:SSL證書,CN財產,必須在服務器名或域名相匹配。 (CN = my-domain.com)適用於my-domain.com上發佈的服務器。
如果您使用的是爲其他服務器名稱或域設計的某個證書,則需要在操作系統主機文件中聲明該匹配項。