From 68459dab00c7ad7c6440800a39de77fc1e80818a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20M=C3=B6ller?= Date: Tue, 30 Dec 2014 05:52:23 +0100 Subject: [PATCH] contrib/sigtest.sh - testing signature --- contrib/sigtest.sh | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 contrib/sigtest.sh diff --git a/contrib/sigtest.sh b/contrib/sigtest.sh new file mode 100755 index 00000000..2ed06d0f --- /dev/null +++ b/contrib/sigtest.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +if [ $# -eq 0 -o "-h" = "$1" -o "-help" = "$1" -o "--help" = "$1" ]; then + cat < + +sigtest.sh checks if a manifest is signed by the public key . There is +no output, success or failure is indicated via the return code. + +See also: + * ecdsautils in https://github.com/tcatm/ecdsautils + * http://gluon.readthedocs.org/en/latest/features/autoupdater.html + +EOHELP + exit 1 +fi + +public="$1" +manifest="$2" +upper="$(mktemp)" +lower="$(mktemp)" +ret=1 + +awk "BEGIN { sep=0 } + /^---\$/ { sep=1; next } + { if(sep==0) print > \"$upper\"; + else print > \"$lower\"}" \ + "$manifest" + +while read line +do + if ecdsaverify -s "$line" -p "$public" "$upper"; then + ret=0 + break + fi +done < "$lower" + +rm -f "$upper" "$lower" +exit $ret