#!/bin/bash

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

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

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

#### meta end

set -x
set -o errexit
set -o nounset
set -o pipefail
set -o errtrace
shopt -s inherit_errexit

source /usr/libexec/helper-scripts/has.sh

true "$0: START"

pwd

has osslsigncode
has sha256sum

file_name="vc_redist.x64.exe"

test -r "$file_name"

## Cannot find root certificate. Signature might be expired.
#osslsigncode verify -in "$file_name"

## Debugging.
sha256sum "$file_name"
#sha512sum "$file_name"

## https://www.virustotal.com/gui/file/1821577409c35b2b9505ac833e246376cc68a8262972100444010b57226f0940?nocache=1
printf '%s\n' "1821577409c35b2b9505ac833e246376cc68a8262972100444010b57226f0940  vc_redist.x64.exe" | sha256sum --check

##
#echo "5935b69f5138ac3fbc33813c74da853269ba079f910936aefa95e230c6092b92f6225bffb594e5dd35ff29bf260e4b35f91adede90fdf5f062030d8666fd0104  vc_redist.x64.exe" | sha512sum --check

true "$0: SUCCESS"
