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,22 +1,23 @@
#!/bin/sh
# Adding an unauthenticated blob to the PE/MSI file.
# Add an unauthenticated blob to the PE/MSI file.
. $(dirname $0)/../test_library
script_path=$(pwd)
# PE file
test_name="361. Adding an unauthenticated blob to the PE file"
test_name="361. Add an unauthenticated blob to 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_361_signed.exe" && \
../../osslsigncode add \
-addUnauthenticatedBlob \
-in "test_361_signed.exe" -out "test_361.exe"'
verify_signature "$?" "361" "exe" "MODIFY" "UNUSED_PATTERN" "ASCII" "BEGIN_BLOB" "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_361_signed.exe"
../../osslsigncode add \
-addUnauthenticatedBlob \
-in "test_361_signed.exe" -out "test_361.exe"
verify_signature "$?" "361" "exe" "success" "@2019-09-01 12:00:00" \
"UNUSED_PATTERN" "ASCII" "BEGIN_BLOB" "MODIFY"
test_result "$?" "$test_name"
else
printf "Test skipped\n"
@ -26,20 +27,19 @@ if [ -s "test.exe" ]
# Command is not supported for non-PE/non-MSI files
# MSI file
test_name="362. Adding an unauthenticated blob to the MSI file"
test_name="362. Add an unauthenticated blob to the MSI file"
printf "\n%s\n" "$test_name"
if [ -s "sample.msi" ]
then
cat "sample.msi" > "test_362.msi"
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_362_signed.msi" && \
../../osslsigncode add \
-addUnauthenticatedBlob \
-in "test_362_signed.msi" -out "test_362.msi"'
verify_signature "$?" "362" "msi" "MODIFY" "UNUSED_PATTERN" "ASCII" "BEGIN_BLOB" "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_362_signed.msi"
../../osslsigncode add \
-addUnauthenticatedBlob \
-in "test_362_signed.msi" -out "test_362.msi"
verify_signature "$?" "362" "msi" "success" "@2019-09-01 12:00:00" \
"UNUSED_PATTERN" "ASCII" "BEGIN_BLOB" "MODIFY"
test_result "$?" "$test_name"
else
printf "Test skipped\n"