Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add certificate download to HTTP status page #401

merged 8 commits into from Jan 25, 2019

Alt method without sun library

  • Loading branch information...
bberenz committed Jan 25, 2019
commit 8a81fa5845f9b1c48f3f326d071df62bdcb450f7
Copy path View file
@@ -1,16 +1,15 @@
package qz.common;

import org.apache.commons.ssl.Base64;
import org.bouncycastle.asn1.x509.BasicConstraints;
import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import qz.utils.SystemUtilities;

import java.nio.charset.StandardCharsets;
@@ -92,8 +91,7 @@ private static JSONObject ssl(KeyStore keystore) throws JSONException, KeyStoreE
JSONObject cert = new JSONObject();
X509Certificate x509 = (X509Certificate)keystore.getCertificate(alias);
cert.put("alias", alias);
try { cert.put("rootca", ((X509CertImpl)x509).getBasicConstraintsExtension().get("is_ca"));}
catch(IOException e) { cert.put("rootca", false);}
cert.put("rootca", BasicConstraints.getInstance(x509).isCA());
cert.put("subject", x509.getSubjectX500Principal().getName());
cert.put("expires", toISO(x509.getNotAfter()));
cert.put("data", formatCert(x509.getEncoded()));
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.