+ private static void revokeCertificates() throws SQLException, IOException, InterruptedException {
+ ResultSet rs = revoke.executeQuery();
+ boolean worked = false;
+ while (rs.next()) {
+ int id = rs.getInt(1);
+ File crt = KeyStorage.locateCrt(id);
+ String[] call = new String[] { "openssl", "ca",//
+ "-cert", "testca.crt",//
+ "-keyfile", "testca.key",//
+ "-revoke", "../" + crt.getPath(),//
+ "-batch",//
+ "-config", "selfsign.config"
+
+ };
+ Process p1 = Runtime.getRuntime().exec(call, null, new File("keys"));
+ System.out.println("revoking: " + crt.getPath());
+ if (p1.waitFor() == 0) {
+ worked = true;
+ revokeCompleted.setInt(1, id);
+ revokeCompleted.execute();
+ } else {
+ System.out.println("Failed");
+ }
+ }
+ if (worked) {
+ gencrl();
+ }
+ }
+
+ private static void gencrl() throws IOException, InterruptedException {
+ String[] call = new String[] { "openssl", "ca",//
+ "-cert", "testca.crt",//
+ "-keyfile", "testca.key",//
+ "-gencrl",//
+ "-crlhours",//
+ "12",//
+ "-out", "testca.crl",//
+ "-config", "selfsign.config"
+
+ };
+ Process p1 = Runtime.getRuntime().exec(call, null, new File("keys"));
+ if (p1.waitFor() != 0) {
+ System.out.println("Error while generating crl.");
+ }
+ }
+
+ private static void signCertificates() throws SQLException, IOException, InterruptedException {