Implement csr/crt storing interface.
authorFelix Dörre <felix@dogcraft.de>
Fri, 4 Jul 2014 23:10:10 +0000 (01:10 +0200)
committerFelix Dörre <felix@dogcraft.de>
Fri, 4 Jul 2014 23:10:10 +0000 (01:10 +0200)
doc/scripts/generateSomeCsrs.sh [new file with mode: 0644]
keys/.gitignore
src/org/cacert/gigi/util/KeyStorage.java [new file with mode: 0644]

diff --git a/doc/scripts/generateSomeCsrs.sh b/doc/scripts/generateSomeCsrs.sh
new file mode 100644 (file)
index 0000000..758342a
--- /dev/null
@@ -0,0 +1,7 @@
+cd `dirname $0`
+
+for i in {4..100}; do
+openssl req -newkey rsa:1024 -nodes -keyout /dev/null \
+       -out $i.csr -subj "/CN=tmp.cacert.local" \
+       -config ../../keys/selfsign.config;
+done
index a90e325..35c683c 100644 (file)
@@ -3,3 +3,5 @@
 *.key
 *.pkcs12
 testca
+csr
+crt
\ No newline at end of file
diff --git a/src/org/cacert/gigi/util/KeyStorage.java b/src/org/cacert/gigi/util/KeyStorage.java
new file mode 100644 (file)
index 0000000..2149f80
--- /dev/null
@@ -0,0 +1,19 @@
+package org.cacert.gigi.util;
+
+import java.io.File;
+
+public class KeyStorage {
+       private static final File csr = new File("keys/csr");
+       private static final File crt = new File("keys/crt");
+
+       public static File locateCrt(int id) {
+               File parent = new File(crt, (id / 1000) + "");
+               parent.mkdirs();
+               return new File(parent, id + ".crt");
+       }
+       public static File locateCsr(int id) {
+               File parent = new File(csr, (id / 1000) + "");
+               parent.mkdirs();
+               return new File(parent, id + ".csr");
+       }
+}