+ public static String escapeAVA(String value) {
+
+ return value.replace("\\", "\\\\").replace("/", "\\/");
+ }
+
+ public static String stringifyDN(HashMap<String, String> contents) {
+ StringBuffer res = new StringBuffer();
+ for (Entry<String, String> i : contents.entrySet()) {
+ res.append("/" + i.getKey() + "=");
+ res.append(escapeAVA(i.getValue()));
+ }
+ return res.toString();
+ }
+
+ public static HashMap<String, String> buildDN(String... contents) {
+ HashMap<String, String> res = new HashMap<>();
+ for (int i = 0; i + 1 < contents.length; i += 2) {
+ res.put(contents[i], contents[i + 1]);
+ }
+ return res;
+ }
+
+ public java.util.Date getRevocationDate() {
+ if (getStatus() == CertificateStatus.REVOKED) {
+ GigiPreparedStatement prep = DatabaseConnection.getInstance().prepare("SELECT revoked FROM certs WHERE id=?");
+ prep.setInt(1, getId());
+ GigiResultSet res = prep.executeQuery();
+ res.beforeFirst();
+ if (res.next()) {
+ return new java.util.Date(res.getDate("revoked").getTime());
+ }
+ }
+ return null;
+ }