]> WPIA git - gigi.git/blobdiff - util/org/cacert/gigi/util/SimpleSigner.java
Implement testing of internal certificate issuing (and login with it)
[gigi.git] / util / org / cacert / gigi / util / SimpleSigner.java
index 2aaa1659d79a7cf7c3793f06af7a80aa13b73be7..cb4e492899fc45dd4ef7f3c413d7d0a16460800b 100644 (file)
@@ -66,30 +66,35 @@ public class SimpleSigner {
                runner = new Thread() {
                        @Override
                        public void run() {
-                               try {
-                                       gencrl();
-                               } catch (IOException e2) {
-                                       e2.printStackTrace();
-                               } catch (InterruptedException e2) {
-                                       e2.printStackTrace();
-                               }
-                               while (running) {
-                                       try {
-                                               signCertificates();
-                                               revokeCertificates();
-                                               Thread.sleep(5000);
-                                       } catch (IOException e) {
-                                               e.printStackTrace();
-                                       } catch (SQLException e) {
-                                               e.printStackTrace();
-                                       } catch (InterruptedException e1) {
-                                       }
-                               }
+                               work();
                        }
+
                };
                runner.start();
        }
 
+       private static void work() {
+               try {
+                       gencrl();
+               } catch (IOException e2) {
+                       e2.printStackTrace();
+               } catch (InterruptedException e2) {
+                       e2.printStackTrace();
+               }
+               while (running) {
+                       try {
+                               signCertificates();
+                               revokeCertificates();
+                               Thread.sleep(5000);
+                       } catch (IOException e) {
+                               e.printStackTrace();
+                       } catch (SQLException e) {
+                               e.printStackTrace();
+                       } catch (InterruptedException e1) {
+                       }
+               }
+       }
+
        private static void revokeCertificates() throws SQLException, IOException, InterruptedException {
                ResultSet rs = revoke.executeQuery();
                boolean worked = false;
@@ -163,7 +168,7 @@ public class SimpleSigner {
                                        X509Certificate crtp = (X509Certificate) cf.generateCertificate(is);
                                        BigInteger serial = crtp.getSerialNumber();
                                        updateMail.setString(1, crt.getPath());
-                                       updateMail.setString(2, serial.toString());
+                                       updateMail.setString(2, serial.toString(16));
                                        updateMail.setInt(3, id);
                                        updateMail.execute();
                                        System.out.println("sign: " + id);