summaryrefslogtreecommitdiffstats
path: root/scripts/nssdb-csr.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/nssdb-csr.sh')
-rwxr-xr-xscripts/nssdb-csr.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/nssdb-csr.sh b/scripts/nssdb-csr.sh
new file mode 100755
index 0000000..f29787e
--- /dev/null
+++ b/scripts/nssdb-csr.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+OUTPUT=nssdb/ca_signing.csr
+
+echo -e "y\n\ny\n" | \
+ certutil -R \
+ -d nssdb \
+ -h internal \
+ -f nssdb/password.txt \
+ -s "CN=CA Signing Certificate,O=EXAMPLE" \
+ -z nssdb/noise.bin \
+ -k rsa \
+ -g 2048 \
+ -Z SHA512 \
+ -2 \
+ --keyUsage digitalSignature,nonRepudiation,certSigning,crlSigning,critical \
+ -o nssdb/ca.csr.der
+
+BtoA nssdb/ca.csr.der nssdb/ca.csr.pem
+echo "-----BEGIN NEW CERTIFICATE REQUEST-----" > $OUTPUT
+cat nssdb/ca.csr.pem >> $OUTPUT
+echo "-----END NEW CERTIFICATE REQUEST-----" >> $OUTPUT
+
+rm nssdb/ca.csr.der
+rm nssdb/ca.csr.pem