throw new IllegalStateException("already running");
}
running = true;
- readyCerts = DatabaseConnection.getInstance().prepare("SELECT certs.id AS id, certs.csr_name, certs.subject, jobs.id AS jobid, csr_type, md, keyUsage, extendedKeyUsage FROM jobs " + //
+ readyCerts = DatabaseConnection.getInstance().prepare("SELECT certs.id AS id, certs.csr_name, certs.subject, jobs.id AS jobid, csr_type, md, keyUsage, extendedKeyUsage, rootcert FROM jobs " + //
"INNER JOIN certs ON certs.id=jobs.targetId " + //
"INNER JOIN profiles ON profiles.id=certs.profile " + //
"WHERE jobs.state='open' "//
String[] call = new String[] {
"openssl", "ca",//
"-cert",
- "testca.crt",//
+ "../unassured.crt",//
"-keyfile",
- "testca.key",//
+ "../unassured.key",//
"-revoke",
- "../" + crt.getPath(),//
+ "../../" + crt.getPath(),//
"-batch",//
"-config",
- "selfsign.config"
+ "../selfsign.config"
};
- Process p1 = Runtime.getRuntime().exec(call, null, new File("keys"));
+ Process p1 = Runtime.getRuntime().exec(call, null, new File("keys/unassured.ca"));
System.out.println("revoking: " + crt.getPath());
if (p1.waitFor() == 0) {
worked = true;
String[] call = new String[] {
"openssl", "ca",//
"-cert",
- "testca.crt",//
+ "../unassured.crt",//
"-keyfile",
- "testca.key",//
+ "../unassured.key",//
"-gencrl",//
"-crlhours",//
"12",//
"-out",
- "testca.crl",//
+ "../unassured.crl",//
"-config",
- "selfsign.config"
+ "../selfsign.config"
};
- Process p1 = Runtime.getRuntime().exec(call, null, new File("keys"));
+ Process p1 = Runtime.getRuntime().exec(call, null, new File("keys/unassured.ca"));
if (p1.waitFor() != 0) {
System.out.println("Error while generating crl.");
}
cfg.println("keyUsage=" + keyUsage);
cfg.println("extendedKeyUsage=" + ekeyUsage);
cfg.close();
+ int rootcert = rs.getInt("rootcert");
+ String ca = "unassured";
+ if (rootcert == 0) {
+ ca = "unassured";
+ } else if (rootcert == 1) {
+ ca = "assured";
+ }
String[] call = new String[] {
"openssl", "ca",//
"-in",
- "../" + csrname,//
+ "../../" + csrname,//
"-cert",
- "testca.crt",//
+ "../" + ca + ".crt",//
"-keyfile",
- "testca.key",//
+ "../" + ca + ".key",//
"-out",
- "../" + crt.getPath(),//
+ "../../" + crt.getPath(),//
+ "-utf8",
"-days",
"356",//
"-batch",//
"-md",
rs.getString("md"),//
"-extfile",
- f.getName(),//
+ "../" + f.getName(),//
"-subj",
rs.getString("subject"),//
"-config",
- "selfsign.config"//
+ "../selfsign.config"//
};
if (ct == CSRType.SPKAC) {
call[2] = "-spkac";
}
- Process p1 = Runtime.getRuntime().exec(call, null, new File("keys"));
+ Process p1 = Runtime.getRuntime().exec(call, null, new File("keys/unassured.ca"));
int waitFor = p1.waitFor();
f.delete();