summaryrefslogtreecommitdiff
path: root/src/se/leap/leapclient/ProviderAPI.java
diff options
context:
space:
mode:
authorSean Leonard <meanderingcode@aetherislands.net>2013-07-12 13:41:42 -0600
committerSean Leonard <meanderingcode@aetherislands.net>2013-07-12 14:27:04 -0600
commit8bd4d61319b1418e5fef2d9f932044b07bfc1f20 (patch)
tree4cb589d197781c1d2ee6f427a9ca239b8abeb3f2 /src/se/leap/leapclient/ProviderAPI.java
parent4dcdb0a2a50722e008395e54ff9228c1d39c231e (diff)
parentdacf638f7dd15e291cdb23a6cf8317e1dd80ed29 (diff)
Merge branch 'feature/certificates-without-files-in-leap-http-client' into develop
Diffstat (limited to 'src/se/leap/leapclient/ProviderAPI.java')
-rw-r--r--src/se/leap/leapclient/ProviderAPI.java17
1 files changed, 3 insertions, 14 deletions
diff --git a/src/se/leap/leapclient/ProviderAPI.java b/src/se/leap/leapclient/ProviderAPI.java
index f3ea5f2e..25a14bb5 100644
--- a/src/se/leap/leapclient/ProviderAPI.java
+++ b/src/se/leap/leapclient/ProviderAPI.java
@@ -452,21 +452,10 @@ public class ProviderAPI extends IntentService {
if(cert_string.isEmpty()) {
cert_string = downloadCertificateWithoutTrusting(url.getProtocol() + "://" + url.getHost() + "/" + "ca.crt");
ConfigHelper.saveSharedPref(ConfigHelper.MAIN_CERT_KEY, cert_string);
- }
- CertificateFactory cf;
+ }
+
try {
- cf = CertificateFactory.getInstance("X.509");
-
- cert_string = cert_string.replaceFirst("-----BEGIN CERTIFICATE-----", "").replaceFirst("-----END CERTIFICATE-----", "").trim();
- byte[] cert_bytes = Base64.decode(cert_string, Base64.DEFAULT);
- InputStream caInput = new ByteArrayInputStream(cert_bytes);
- java.security.cert.Certificate dangerous_certificate;
- try {
- dangerous_certificate = cf.generateCertificate(caInput);
- System.out.println("dangerous certificate =" + ((X509Certificate) dangerous_certificate).getSubjectDN());
- } finally {
- caInput.close();
- }
+ java.security.cert.Certificate dangerous_certificate = ConfigHelper.parseX509CertificateFromString(cert_string);
// Create a KeyStore containing our trusted CAs
String keyStoreType = KeyStore.getDefaultType();