#!/bin/sh
#Script to validate digital signature
#  $1 is the file to validate
#  $2 is the signature file
#  $3 is the signature key file
#  exit with status of 0 if valid

# Create sha256 digest file of the input file with new line removed
echo -n `sha256sum "$1" | cut -d ' ' -f 1` > "$1.sha256"

# Verify the signature against digest file and public key
openssl dgst -sha1 -verify "$3" -signature "$2"  "$1.sha256"
