mirror of
https://github.com/mtrojnar/osslsigncode.git
synced 2025-04-04 08:50:12 -05:00
41 lines
1.2 KiB
Bash
41 lines
1.2 KiB
Bash
#!/bin/sh
|
|
# Compare the leaf certificate hash against specified SHA256 message digest for the PE/MSI file
|
|
|
|
. $(dirname $0)/../test_library
|
|
script_path=$(pwd)
|
|
|
|
# PE file
|
|
test_name="401. Compare the leaf certificate hash against specified SHA256 message digest for the PE file"
|
|
printf "\n%s\n" "$test_name"
|
|
if [ -s "test.exe" ]
|
|
then
|
|
../../osslsigncode sign -h sha256 \
|
|
-st "1556668800" \
|
|
-certs "${script_path}/../certs/cert.pem" -key "${script_path}/../certs/key.der" \
|
|
-in "test.exe" -out "test_401.exe"
|
|
verify_leaf_hash "$?" "401" "exe" "@2019-05-01 00:00:00"
|
|
test_result "$?" "$test_name"
|
|
else
|
|
printf "Test skipped\n"
|
|
fi
|
|
|
|
# CAB file
|
|
# Command is not supported for non-PE/non-MSI files
|
|
|
|
# MSI file
|
|
test_name="403. Compare the leaf certificate hash against specified SHA256 message digest for the MSI file"
|
|
printf "\n%s\n" "$test_name"
|
|
if [ -s "sample.msi" ]
|
|
then
|
|
../../osslsigncode sign -h sha256 \
|
|
-st "1556668800" \
|
|
-certs "${script_path}/../certs/cert.pem" -key "${script_path}/../certs/key.der" \
|
|
-in "sample.msi" -out "test_403.msi"
|
|
verify_leaf_hash "$?" "403" "msi" "@2019-05-01 00:00:00"
|
|
test_result "$?" "$test_name"
|
|
else
|
|
printf "Test skipped\n"
|
|
fi
|
|
|
|
exit 0
|