summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2013-09-30 11:53:40 +0200
committerParménides GV <parmegv@sdf.org>2013-09-30 11:53:40 +0200
commit4e21714544d3e7002fea884fabbd75b5ebc1d05f (patch)
tree01cc3e183c1da2c1592ad0b8fc99321cbc3f1e2e
parentfdc8d5376c6d44c2a78ee023e89417cddabfbd44 (diff)
Erroneous CA cert download correctly handled.
If there is an error while downloading CA cert on downloadJsonFiles, false is returned and progress dialog is dismissed.
-rw-r--r--src/se/leap/leapclient/ConfigurationWizard.java1
-rw-r--r--src/se/leap/leapclient/ProviderAPI.java1
2 files changed, 2 insertions, 0 deletions
diff --git a/src/se/leap/leapclient/ConfigurationWizard.java b/src/se/leap/leapclient/ConfigurationWizard.java
index 4a8158d6..dd9f4121 100644
--- a/src/se/leap/leapclient/ConfigurationWizard.java
+++ b/src/se/leap/leapclient/ConfigurationWizard.java
@@ -143,6 +143,7 @@ implements ProviderListFragment.Callbacks, NewProviderDialog.NewProviderDialogIn
}
else if(resultCode == ProviderAPI.INCORRECTLY_DOWNLOADED_JSON_FILES) {
//Toast.makeText(getApplicationContext(), R.string.incorrectly_downloaded_json_files_message, Toast.LENGTH_LONG).show();
+ mProgressDialog.dismiss();
setResult(RESULT_CANCELED, mConfigState);
}
else if(resultCode == ProviderAPI.CORRECTLY_DOWNLOADED_CERTIFICATE) {
diff --git a/src/se/leap/leapclient/ProviderAPI.java b/src/se/leap/leapclient/ProviderAPI.java
index bc1602dc..0935cd8d 100644
--- a/src/se/leap/leapclient/ProviderAPI.java
+++ b/src/se/leap/leapclient/ProviderAPI.java
@@ -196,6 +196,7 @@ public class ProviderAPI extends IntentService {
boolean danger_on = task.getBoolean(ProviderItem.DANGER_ON);
try {
String cert_string = downloadWithCommercialCA(cert_url, danger_on);
+ if(cert_string.isEmpty()) return false;
X509Certificate certCert = ConfigHelper.parseX509CertificateFromString(cert_string);
cert_string = Base64.encodeToString( certCert.getEncoded(), Base64.DEFAULT);
ConfigHelper.saveSharedPref(Provider.CA_CERT, "-----BEGIN CERTIFICATE-----\n"+cert_string+"-----END CERTIFICATE-----");