summaryrefslogtreecommitdiff
path: root/src/se/leap/leapclient/LeapHttpClient.java
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2013-04-16 18:16:28 +0200
committerParménides GV <parmegv@sdf.org>2013-04-16 18:16:28 +0200
commit4c88da9973a5d252d06e487e6d57781e79ab5eab (patch)
tree0d85848b9b0a036147dd53b5ba847b8227e38f49 /src/se/leap/leapclient/LeapHttpClient.java
parent60e5f181c1a9f4f1851aafd059971ba5d05748f3 (diff)
parentfbfdf86a1df28ccf8f1854c2e2a4c7b3135d50ae (diff)
Merge branch 'feature/wizard' into develop
Diffstat (limited to 'src/se/leap/leapclient/LeapHttpClient.java')
-rw-r--r--src/se/leap/leapclient/LeapHttpClient.java16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/se/leap/leapclient/LeapHttpClient.java b/src/se/leap/leapclient/LeapHttpClient.java
index fd6db745..d1908c34 100644
--- a/src/se/leap/leapclient/LeapHttpClient.java
+++ b/src/se/leap/leapclient/LeapHttpClient.java
@@ -1,6 +1,5 @@
package se.leap.leapclient;
-import java.io.InputStream;
import java.security.KeyStore;
import org.apache.http.conn.ClientConnectionManager;
@@ -35,23 +34,16 @@ public class LeapHttpClient extends DefaultHttpClient {
private SSLSocketFactory newSslSocketFactory() {
try {
// Get an instance of the Bouncy Castle KeyStore format
- KeyStore trusted = KeyStore.getInstance("BKS");
- // Get the raw resource, which contains the keystore with
- // your trusted certificates (root and any intermediate certs)
- InputStream in = context.getResources().openRawResource(R.raw.leapkeystore);
- try {
- // Initialize the keystore with the provided trusted certificates
- // Also provide the password of the keystore
- trusted.load(in, "uer92jf".toCharArray());
- } finally {
- in.close();
- }
+ KeyStore trusted = ConfigHelper.getKeystore();
+
// Pass the keystore to the SSLSocketFactory. The factory is responsible
// for the verification of the server certificate.
SSLSocketFactory sf = new SSLSocketFactory(trusted);
+
// Hostname verification from certificate
// http://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html#d4e506
sf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
+
return sf;
} catch (Exception e) {
throw new AssertionError(e);