summaryrefslogtreecommitdiff
path: root/src/se/leap/leapclient/ProviderAPI.java
diff options
context:
space:
mode:
authorParménides GV <parmegv@ma.sdf.org>2013-06-24 19:37:35 +0200
committerParménides GV <parmegv@ma.sdf.org>2013-06-24 19:37:35 +0200
commit50db5b5816476751f39bb7b8adc927562a0cc677 (patch)
treefa8fc602518430137895fbdbaba439f6c3d92321 /src/se/leap/leapclient/ProviderAPI.java
parent195d5ab2d518f6f3960edd3c636e941830c2664d (diff)
parent304b29d6cb85d710756a56bc9c009429b8407d69 (diff)
Merge branch 'feature/eip' into develop
Diffstat (limited to 'src/se/leap/leapclient/ProviderAPI.java')
-rw-r--r--src/se/leap/leapclient/ProviderAPI.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/se/leap/leapclient/ProviderAPI.java b/src/se/leap/leapclient/ProviderAPI.java
index 00d7d820..72cc9b62 100644
--- a/src/se/leap/leapclient/ProviderAPI.java
+++ b/src/se/leap/leapclient/ProviderAPI.java
@@ -584,8 +584,18 @@ public class ProviderAPI extends IntentService {
boolean danger_on = ConfigHelper.getBoolFromSharedPref(ConfigHelper.DANGER_ON);
String cert_string = getStringFromProvider(new_cert_string_url, danger_on);
- if(!cert_string.isEmpty()) {
- ConfigHelper.saveSharedPref(ConfigHelper.CERT_KEY, cert_string);
+ if(!cert_string.isEmpty()) {
+ // API returns concatenated cert & key. Split them for OpenVPN options
+ String certificate = null, key = null;
+ String[] certAndKey = cert_string.split("(?<=-\n)");
+ for (int i=0; i < certAndKey.length-1; i++){
+ if ( certAndKey[i].contains("KEY") )
+ key = certAndKey[i++] + certAndKey[i];
+ else if ( certAndKey[i].contains("CERTIFICATE") )
+ certificate = certAndKey[i++] + certAndKey[i];
+ }
+ ConfigHelper.saveSharedPref(ConfigHelper.CERT_KEY, certificate);
+ ConfigHelper.saveSharedPref(ConfigHelper.KEY_KEY, key);
return true;
} else {
return false;