summaryrefslogtreecommitdiff
path: root/gecko/gensig.sh
diff options
context:
space:
mode:
Diffstat (limited to 'gecko/gensig.sh')
-rwxr-xr-xgecko/gensig.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/gecko/gensig.sh b/gecko/gensig.sh
new file mode 100755
index 0000000..13c0447
--- /dev/null
+++ b/gecko/gensig.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# Currently not working - using uhura instead.
+
+if test $# -ne 2; then
+ echo "Usage: $0 update.rdf pem"
+ echo "Outputs a signature suitable for use in update.rdf"
+ exit 1
+fi
+
+# serialise all but the signature entry
+# in mccoy this is serializeResource(), in mexumgen it's ser()
+# exerything else seems to rewrite things, but we *might* get away with sed-ing away the bad line and outputting as rdfxml
+# sha512 hash
+# sign the hash
+# der encode & base64
+
+sed '/em:signature/d' < "$1" | rapper -i turtle -o rdfxml /dev/stdin 2>/dev/null \
+| sha512sum \
+| openssl sha1 -sha1 -binary -sign "$2" \
+| openssl enc -e -a 2>/dev/null \
+| awk '{printf("%s", $0)}' | sed 's/\//\\\//g'