summaryrefslogtreecommitdiff
path: root/tools/create-key.sh
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2017-02-11 00:24:20 +0100
committerLinus Nordberg <linus@nordu.net>2017-02-11 00:24:20 +0100
commitc7031b2d5cfa6a67253282a69bb3b7f6550f9d5d (patch)
treef7cf0e9d7044ea0b023ef5bcc71620f0974a4ec9 /tools/create-key.sh
parentf906fa34a56185c6da816f7912d30ca6fa8be6d5 (diff)
Be more careful with secret keys.
Diffstat (limited to 'tools/create-key.sh')
-rwxr-xr-xtools/create-key.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/create-key.sh b/tools/create-key.sh
index 9d29c86..e54b56b 100755
--- a/tools/create-key.sh
+++ b/tools/create-key.sh
@@ -1,4 +1,10 @@
#!/bin/sh
+set -o errexit
+set -o nounset
+
+[ -f $1-private.pem ] && { echo "$0: $1-private.pem exists, exiting"; exit 1; }
+touch $1-private.pem
+chmod 600 $1-private.pem
openssl ecparam -name prime256v1 -genkey -noout -out $1-private.pem
openssl ec -in $1-private.pem -pubout -out $1.pem