Commit deafcfed authored by Grigory Fedorov's avatar Grigory Fedorov

Pull request #408 by @alexte - Certificate handling

parent 37480cb8
package org.jivesoftware.smack; package org.jivesoftware.smack;
import org.apache.http.conn.ssl.AbstractVerifier;
import org.apache.http.conn.ssl.BrowserCompatHostnameVerifier;
import java.security.KeyManagementException; import java.security.KeyManagementException;
import java.security.KeyStore; import java.security.KeyStore;
import java.security.KeyStoreException; import java.security.KeyStoreException;
...@@ -12,9 +15,6 @@ import javax.net.ssl.TrustManager; ...@@ -12,9 +15,6 @@ import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory; import javax.net.ssl.TrustManagerFactory;
import javax.net.ssl.X509TrustManager; import javax.net.ssl.X509TrustManager;
import org.apache.http.conn.ssl.AbstractVerifier;
import org.apache.http.conn.ssl.BrowserCompatHostnameVerifier;
class XMPPTrustManager implements X509TrustManager { class XMPPTrustManager implements X509TrustManager {
private final X509TrustManager trustManager; private final X509TrustManager trustManager;
...@@ -78,7 +78,7 @@ class XMPPTrustManager implements X509TrustManager { ...@@ -78,7 +78,7 @@ class XMPPTrustManager implements X509TrustManager {
private void checkChain(X509Certificate[] chain, String authType) private void checkChain(X509Certificate[] chain, String authType)
throws CertificateException { throws CertificateException {
try { try {
trustManager.checkClientTrusted(chain, authType); trustManager.checkServerTrusted(chain, authType);
} catch (CertificateException e) { } catch (CertificateException e) {
if (allowSelfSigned && isSelfSigned(chain)) { if (allowSelfSigned && isSelfSigned(chain)) {
if (listener.onSelfSigned(chain[0], e)) if (listener.onSelfSigned(chain[0], e))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment