tests improvements

This commit is contained in:
olszomal
2019-12-06 14:03:59 +01:00
committed by Michał Trojnara
parent a77ed9c9e1
commit d36a10bf09
31 changed files with 620 additions and 586 deletions

View File

@ -1,21 +1,22 @@
#!/bin/sh
# Extracting the signature from the PE/MSI file.
# Extract the signature from the PE/MSI file.
. $(dirname $0)/../test_library
script_path=$(pwd)
# PE file
test_name="311. Extracting the signature from the PE file"
test_name="311. Extract the signature from the PE file"
printf "\n%s\n" "$test_name"
if [ -s "test.exe" ]
then
faketime -f '@2019-01-01 00:00:00' /bin/bash -c '
script_path=$(pwd)
../../osslsigncode sign -h sha256 \
-certs "${script_path}/../certs/cert.pem" -key "${script_path}/../certs/key.pem" \
-in "test.exe" -out "test_311.exe" && \
../../osslsigncode extract-signature -pem \
-in "test_311.exe" -out "sign_pe.pem"'
verify_signature "$?" "311" "exe" "UNUSED_PATTERN" "sha256sum" "ASCII" "osslsigncode" "UNUSED_PATTERN"
../../osslsigncode sign -h sha256 \
-st "1556668800" \
-certs "${script_path}/../certs/cert.pem" -key "${script_path}/../certs/key.pem" \
-in "test.exe" -out "test_311.exe" && \
../../osslsigncode extract-signature -pem \
-in "test_311.exe" -out "sign_pe.pem"
verify_signature "$?" "311" "exe" "success" "@2019-09-01 12:00:00" \
"sha256sum" "ASCII" "osslsigncode" "UNUSED_PATTERN"
test_result "$?" "$test_name"
else
printf "Test skipped\n"
@ -25,18 +26,18 @@ if [ -s "test.exe" ]
# Command is not supported for non-PE/non-MSI files
# MSI file
test_name="312. Extracting the signature from the MSI file"
test_name="312. Extract the signature from the MSI file"
printf "\n%s\n" "$test_name"
if [ -s "sample.msi" ]
then
faketime -f '@2019-01-01 00:00:00' /bin/bash -c '
script_path=$(pwd)
../../osslsigncode sign -h sha256 \
-certs "${script_path}/../certs/cert.pem" -key "${script_path}/../certs/key.pem" \
-in "sample.msi" -out "test_312.msi" && \
../../osslsigncode extract-signature -pem \
-in "test_312.msi" -out "sign_msi.pem"'
verify_signature "$?" "312" "msi" "UNUSED_PATTERN" "sha256sum" "ASCII" "osslsigncode" "UNUSED_PATTERN"
../../osslsigncode sign -h sha256 \
-st "1556668800" \
-certs "${script_path}/../certs/cert.pem" -key "${script_path}/../certs/key.pem" \
-in "sample.msi" -out "test_312.msi" && \
../../osslsigncode extract-signature -pem \
-in "test_312.msi" -out "sign_msi.pem"
verify_signature "$?" "312" "msi" "success" "@2019-09-01 12:00:00" \
"sha256sum" "ASCII" "osslsigncode" "UNUSED_PATTERN"
test_result "$?" "$test_name"
else
printf "Test skipped\n"