]> the.earth.li Git - onak.git/blobdiff - t/all-037-check-sigs.t
Add a test for signature verification
[onak.git] / t / all-037-check-sigs.t
diff --git a/t/all-037-check-sigs.t b/t/all-037-check-sigs.t
new file mode 100755 (executable)
index 0000000..ed02c23
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/sh
+# Check that signatures are only added when they can be verified
+
+set -e
+
+cd ${WORKDIR}
+cp $1 check-sigs.ini
+
+trap cleanup exit
+cleanup () {
+       rm check-sigs.ini
+}
+echo verify_signatures=true >> check-sigs.ini
+
+${BUILDDIR}/onak -b -c check-sigs.ini add < ${TESTSDIR}/../keys/noodles-ecc.key || true
+if ${BUILDDIR}/onak -c $1 vindex 0x9026108FB942BEA4 2>&1 | \
+       grep -q '0x94FA372B2DA8B985'; then
+       echo "* Did not correctly strip unknown signatures"
+       exit 1
+fi
+
+${BUILDDIR}/onak -b -c check-sigs.ini add < ${TESTSDIR}/../keys/noodles.key || true
+
+${BUILDDIR}/onak -b -c check-sigs.ini add < ${TESTSDIR}/../keys/noodles-ecc.key || true
+if ! ${BUILDDIR}/onak -c $1 vindex 0x9026108FB942BEA4 2>&1 | \
+       grep -q '0x94FA372B2DA8B985'; then
+       echo "* Did not correctly verify new signature"
+       exit 1
+fi
+
+exit 0