0
忽略它之後,我用下面的代碼試圖繞過證書:獲得SSL錯誤,甚至使用的TrustManager
私有靜態HttpClient的wrapClient(HttpClient的基地)拋出AGException { 嘗試 { 的SSLContext CTX = SSLContext.getInstance ( 「TLS」);
X509TrustManager tm = new X509TrustManager()
{
public void checkClientTrusted(X509Certificate[] xcs, String string) throws CertificateException
{
}
public void checkServerTrusted(X509Certificate[] xcs, String string) throws CertificateException {
}
public X509Certificate[] getAcceptedIssuers() {
return null;
}
};
ctx.init(null, new TrustManager[] { tm }, null);
SSLSocketFactory ssf = new SSLSocketFactory(ctx,SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
ClientConnectionManager ccm = base.getConnectionManager();
SchemeRegistry sr = ccm.getSchemeRegistry();
sr.register(new Scheme("https", 443, ssf));
return new DefaultHttpClient(ccm, base.getParams());
}
catch (NoSuchAlgorithmException nsaex)
{
throw new AGException(nsaex, "Not able to get the SSL Context");
}
catch (KeyManagementException kmex) {
throw new AGException(kmex, "Not able to get the SSL Context");
}
}
,但仍提示以下錯誤: javax.net.ssl.SSLPeerUnverifiedException:同行不認證
就向大家介紹我的分配新建分配FY:
我使用膩子隧道到服務器並通過https調用SOAP來連接到該服務器 ,但即使嘗試使用上述代碼也會收到相同的錯誤。
任何幫助/ suggesstions將非常appricates。 在此先感謝。
-Nitish
當你說peer,這意味着客戶端或服務器? 在我的情況下,我沒有在我身邊使用任何證書,正如我所提到的,我想忽略在我身邊使用任何證書。 總而言之,我想調用一個安全服務器(https呼叫)忽略握手,併爲此使用上面的代碼。 如果您可以共享正確的代碼或告訴我的代碼中要更改的位置,這將非常有幫助。 在此先感謝。 – Nitish 2013-04-22 19:54:00
當我說'同輩'時,我指的是電線另一端的那個人。 – EJP 2013-04-24 10:31:50