Skip to content

Commit

Permalink
Merge pull request #361 from haiwen/fix-handling-certs-chain
Browse files Browse the repository at this point in the history
fixed a issue when handling certificates chain
  • Loading branch information
Logan676 committed Jun 4, 2015
2 parents 2922515 + 01a8f78 commit d85b6a6
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/com/seafile/seadroid2/SSLTrustManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,23 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;

import javax.net.ssl.*;
import javax.net.ssl.SSLException;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;

import org.apache.http.conn.ssl.BrowserCompatHostnameVerifier;
import org.apache.http.conn.ssl.X509HostnameVerifier;

import android.os.Build;
import android.util.Log;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.seafile.seadroid2.account.Account;
import org.apache.http.conn.ssl.BrowserCompatHostnameVerifier;
import org.apache.http.conn.ssl.X509HostnameVerifier;

public final class SSLTrustManager {
public enum SslFailureReason {
Expand Down Expand Up @@ -145,7 +150,9 @@ public List<X509Certificate> orderCerts(X509Certificate[] certificates) {
return ImmutableList.of();
}

List<X509Certificate> certs = Lists.newArrayList(certificates);
Set<X509Certificate> all = Sets.newHashSet(certificates);

List<X509Certificate> certs = Lists.newArrayList(all);
// certs.addAll(Arrays.asList(certificates));
X509Certificate certChain = certs.get(0);
certs.remove(certChain);
Expand Down

0 comments on commit d85b6a6

Please sign in to comment.