#!/bin/bash

## Copyright (C) 2023 - 2023 ENCRYPTED SUPPORT LP <adrelanos@whonix.org>
## See the file COPYING for copying conditions.

#### meta start
#### project Kicksecure
#### category security
#### description

## Verifies the integrity of VirtualBox.exe.
## This script assumes that the calling script previously changed directory
## into the folder which contains the VirtualBox.exe.

#### meta end

set -x
set -e

true "$0: START"

pwd

counter=0
for file_name in ./VirtualBox-*.exe ; do
  counter=$((counter + 1))
done

if [ "$counter" -gt "1" ]; then
  true "$0: ERROR: Multiple file matching VirtualBox-*.exe!"
  exit 1
fi

test -r "$file_name"

osslsigncode verify -in "$file_name"

sha256sum --ignore-missing --strict --check SHA256SUMS

true "$0: SUCCESS"
