diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2011-10-04 23:35:15 +0200 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2011-10-04 23:35:15 +0200 |
| commit | 4905590635f06021873966d8302885d52301665c (patch) | |
| tree | 357583ae67ab6bb6a16f0ee32ac506f78e521758 | |
| parent | 0dcbec215dfe5a868f434cd66640f2140f8f342d (diff) | |
| download | cgeo-4905590635f06021873966d8302885d52301665c.zip cgeo-4905590635f06021873966d8302885d52301665c.tar.gz cgeo-4905590635f06021873966d8302885d52301665c.tar.bz2 | |
Remove unused method trustAllHosts
We happen not to make requests to untrusted https URIs from the
code. And if external services are hosted on untrusted sites,
we should probably not let the user use them without warning anyway.
| -rw-r--r-- | main/src/cgeo/geocaching/cgBase.java | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/main/src/cgeo/geocaching/cgBase.java b/main/src/cgeo/geocaching/cgBase.java index 20f29e2..d9a336e 100644 --- a/main/src/cgeo/geocaching/cgBase.java +++ b/main/src/cgeo/geocaching/cgBase.java @@ -61,8 +61,6 @@ import java.net.NetworkInterface; import java.net.SocketException; import java.net.URLDecoder; import java.net.URLEncoder; -import java.security.cert.CertificateException; -import java.security.cert.X509Certificate; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -79,11 +77,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.net.ssl.HostnameVerifier; -import javax.net.ssl.HttpsURLConnection; -import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSession; -import javax.net.ssl.TrustManager; -import javax.net.ssl.X509TrustManager; /** * @author bananeweizen @@ -2805,31 +2799,6 @@ public class cgBase { } }; - public static void trustAllHosts() { - TrustManager[] trustAllCerts = new TrustManager[] { - new X509TrustManager() { - - public java.security.cert.X509Certificate[] getAcceptedIssuers() { - return new java.security.cert.X509Certificate[] {}; - } - - public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { - } - - public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { - } - } - }; - - try { - SSLContext sc = SSLContext.getInstance("TLS"); - sc.init(null, trustAllCerts, new java.security.SecureRandom()); - HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); - } catch (Exception e) { - Log.e(Settings.tag, "cgBase.trustAllHosts: " + e.toString()); - } - } - public static void postTweetCache(cgeoapplication app, String geocode) { final cgCache cache = app.getCacheByGeocode(geocode); String status; |
