#!/bin/sh # Sign a PE/CAB/MSI file with the commercial purpose set for SPC_STATEMENT_TYPE_OBJID # object ID numbers (OIDs) "1.3.6.1.4.1.311.2.1.11" # changes default Individual Code Signing: "0x30, 0x0c, x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x02, 0x01, 0x15" # sets Commercial Code Signing: "0x30, 0x0c, x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x02, 0x01, 0x16" . $(dirname $0)/../test_library script_path=$(pwd) # PE file test_name="161. Sign a PE file with the common purpose set" printf "\n%s\n" "$test_name" if test -s "test.exe" then ../../osslsigncode sign -h sha256 \ -st "1556668800" \ -comm \ -certs "${script_path}/../certs/cert.pem" -key "${script_path}/../certs/key.pem" \ -in "test.exe" -out "test_161.exe" verify_signature "$?" "161" "exe" "success" "@2019-09-01 12:00:00" \ "UNUSED_PATTERN" "HEX" "300c060a2b060104018237020116" "UNUSED_PATTERN" test_result "$?" "$test_name" else printf "Test skipped\n" fi # CAB file test_name="162. Sign a CAB file with the common purpose set" printf "\n%s\n" "$test_name" if test -s "test.ex_" then ../../osslsigncode sign -h sha256 \ -st "1556668800" \ -comm \ -certs "${script_path}/../certs/cert.pem" -key "${script_path}/../certs/key.pem" \ -in "test.ex_" -out "test_162.ex_" verify_signature "$?" "162" "ex_" "success" "@2019-09-01 12:00:00" \ "UNUSED_PATTERN" "HEX" "300c060a2b060104018237020116" "UNUSED_PATTERN" test_result "$?" "$test_name" else printf "Test skipped\n" fi # MSI file test_name="163. Sign a MSI file with the common purpose set" printf "\n%s\n" "$test_name" if test -s "sample.msi" then ../../osslsigncode sign -h sha256 \ -st "1556668800" \ -comm \ -certs "${script_path}/../certs/cert.pem" -key "${script_path}/../certs/key.pem" \ -in "sample.msi" -out "test_163.msi" verify_signature "$?" "163" "msi" "success" "@2019-09-01 12:00:00" \ "UNUSED_PATTERN" "HEX" "300c060a2b060104018237020116" "UNUSED_PATTERN" test_result "$?" "$test_name" else printf "Test skipped\n" fi exit 0