summaryrefslogtreecommitdiffstats
path: root/pubkey
diff options
context:
space:
mode:
authorAlexander Sulfrian <alex@spline.inf.fu-berlin.de>2015-11-17 01:43:35 +0100
committerAlexander Sulfrian <alex@spline.inf.fu-berlin.de>2015-11-17 01:43:35 +0100
commitb125d69848aaac1265b70b59aea3a4bcd37de54c (patch)
tree27b02383061e9cea91447211f8ff165ccfb3ead0 /pubkey
parent58d8d656e3e805888de2932ff58c71ba76e8027b (diff)
downloadbcfg2-tools-b125d69848aaac1265b70b59aea3a4bcd37de54c.tar.gz
bcfg2-tools-b125d69848aaac1265b70b59aea3a4bcd37de54c.tar.bz2
bcfg2-tools-b125d69848aaac1265b70b59aea3a4bcd37de54c.zip
show-req: Add utility to show pending siging requests
Also adds "pubkey" to generate the pubkey of a private key for a certificate request at the DFN.
Diffstat (limited to 'pubkey')
-rwxr-xr-xpubkey27
1 files changed, 27 insertions, 0 deletions
diff --git a/pubkey b/pubkey
new file mode 100755
index 0000000..4a6d781
--- /dev/null
+++ b/pubkey
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+KEY=$1
+PASS=$2
+
+declare -a ARGS
+if [[ -n "$KEY" ]]; then
+ if [[ ! -r "$KEY" ]]; then
+ echo "Usage: $0 [KEY [PASSFILE]]" >&2
+ exit 1
+ fi
+
+ ARGS+=("-in" "$KEY")
+fi
+
+if [[ -n "$PASS" ]]; then
+ if [[ ! -r "$PASS" ]]; then
+ echo "Usage: $0 [KEY [PASSFILE]]" >&2
+ exit 1
+ fi
+
+ ARGS+=("-passin" "file:$PASS")
+fi
+
+openssl rsa "${ARGS[@]}" -pubout 2>/dev/null | \
+ openssl rsa -pubin -noout -text | \
+ sed -e '/Modulus:$/d;s/Public-Key: (\(.*\))/Modulus (\1):/'