Commit 026c6ba1 authored by Boris Lucas's avatar Boris Lucas
Browse files

Expect a boolean value directly rather than a json for "listAllCerts" option

parent 867fb13d
......@@ -3,9 +3,6 @@ package coop.libriciel;
import coop.libriciel.action.ListCertsAction;
import coop.libriciel.action.SignAction;
import coop.libriciel.util.JSONUtils;
import org.apache.commons.lang.StringUtils;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.security.InvalidKeyException;
......@@ -27,19 +24,7 @@ public class NewSignatureMethodHandler {
}
public static String listCerts(String jsonOptions) throws NoSuchAlgorithmException, CertificateEncodingException {
boolean listAllCerts = false;
if (!StringUtils.isEmpty(jsonOptions)) {
try {
JSONObject jOptions = new JSONObject(jsonOptions);
listAllCerts = jOptions.has("listAll") && jOptions.getBoolean("listAll");
System.out.println("listCerts - force listing of all certificates : " + listAllCerts);
} catch (JSONException e) {
// then just let listAllCerts be false
}
}
public static String listCerts(boolean listAllCerts) throws NoSuchAlgorithmException, CertificateEncodingException {
return listCertsAction.getCertificates(listAllCerts);
}
......
......@@ -269,8 +269,8 @@ public class Main extends javax.swing.JApplet implements Runnable {
return NewSignatureMethodHandler.listCerts();
}
public String getCertificates(String jsonOptions) throws CertificateEncodingException, NoSuchAlgorithmException {
return NewSignatureMethodHandler.listCerts(jsonOptions);
public String getCertificates(boolean listAllCerts) throws CertificateEncodingException, NoSuchAlgorithmException {
return NewSignatureMethodHandler.listCerts(listAllCerts);
}
public String sign(String certificateID, String dataToSign) throws NoSuchAlgorithmException, NoSuchProviderException, SignatureException, InvalidKeyException, IOException {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment