runner.start();
}
+ public static void ping() {
+ synchronized (SimpleSigner.class) {
+ SimpleSigner.class.notifyAll();
+ try {
+ SimpleSigner.class.wait(2000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
private synchronized static void work() {
try {
gencrl();
signCertificates();
revokeCertificates();
+ SimpleSigner.class.notifyAll();
SimpleSigner.class.wait(5000);
} catch (IOException e) {
e.printStackTrace();
return;
}
String[] call = new String[] {
- "openssl", "ca",//
+ "openssl",
+ "ca",//
"-cert",
"../unassured.crt",//
"-keyfile",
}
}
- private static int counter = 0;
-
private static void signCertificates() throws SQLException {
GigiResultSet rs = readyCerts.executeQuery();
try (FileInputStream inStream = new FileInputStream("signer/profiles/" + s)) {
caP.load(inStream);
}
- String ca = caP.getProperty("ca") + "_2015_1";
HashMap<String, String> subj = new HashMap<>();
try (GigiPreparedStatement ps = new GigiPreparedStatement("SELECT name, value FROM `certAvas` WHERE `certId`=?")) {
PKCS10 p10 = new PKCS10(PEM.decode("(NEW )?CERTIFICATE REQUEST", new String(data, "UTF-8")));
pk = p10.getSubjectPublicKeyInfo();
}
- PrivateKey i = loadOpensslKey(new File("signer/ca/" + ca + "/ca.key"));
+ String ca = caP.getProperty("ca") + "_2015_1";
+ File parent = new File("signer/ca");
+ File[] caFiles = parent.listFiles();
+ if (null == caFiles) {
+ caFiles = new File[0];
+ }
+ for (File f : caFiles) {
+ if (f.getName().startsWith(caP.getProperty("ca"))) {
+ ca = f.getName();
+ break;
+ }
+ }
+ File caKey = new File(parent, ca + "/ca.key");
+ PrivateKey i = loadOpensslKey(caKey);
X509Certificate root = (X509Certificate) CertificateFactory.getInstance("X509").generateCertificate(new FileInputStream("signer/ca/" + ca + "/ca.crt"));
byte[] cert = generateCert(pk, i, subj, root.getSubjectX500Principal(), altnames, fromDate, toDate, Digest.valueOf(rs.getString("md").toUpperCase()), caP.getProperty("eku"));
private static byte[] generateKU() throws IOException {
try (DerOutputStream dos = new DerOutputStream()) {
dos.putBitString(new byte[] {
- (byte) 0b10101000
+ (byte) 0b10101000
});
return dos.toByteArray();
}