#!/bin/sh # Sign a PE/CAB/MSI file twice with the "nest" flag in the second time # in order to add the new signature instead of replacing the first one. . $(dirname $0)/../test_library script_path=$(pwd) # PE file test_name="111. Sign a PE file with the nest flag" 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.pem" \ -in "test.exe" -out "test_111_signed.exe" ../../osslsigncode sign -h sha512 \ -nest \ -st "1556668800" \ -certs "${script_path}/../certs/cert.pem" -key "${script_path}/../certs/key.pem" \ -in "test_111_signed.exe" -out "test_111.exe" verify_signature "$?" "111" "exe" "success" "@2019-09-01 12:00:00" \ "UNUSED_PATTERN" "ASCII" "SHA512" "UNUSED_PATTERN" test_result "$?" "$test_name" else printf "Test skipped\n" fi # CAB file # Error: -nest option is only valid for PE/MSI files # MSI file test_name="113. Sign a MSI file with the nest flag" 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.pem" \ -in "sample.msi" -out "test_113_signed.msi" ../../osslsigncode sign -h sha512 \ -nest \ -st "1556668800" \ -certs "${script_path}/../certs/cert.pem" -key "${script_path}/../certs/key.pem" \ -in "test_113_signed.msi" -out "test_113.msi" verify_signature "$?" "113" "msi" "success" "@2019-09-01 12:00:00" \ "UNUSED_PATTERN" "ASCII" "SHA512" "UNUSED_PATTERN" test_result "$?" "$test_name" else printf "Test skipped\n" fi exit 0