#!/bin/sh
if [ $# -lt 2 ]; then
echo "Usage: $0 public-key file [sig file]"
exit
fi
cert=$1
file=$2
sig=$2.sig
if [ $# -eq 3 ]; then
sig=$3
fi
openssl base64 -d < $sig > $file.bsig
openssl dgst -sha256 -verify $cert -signature $file.bsig $file
rm -f $file.bsig