@echo off REM =============================================================== REM sign.cmd - Code signing helper script REM Usage: REM sign.cmd certFile certPassword "Subject Name" fileToSign REM Example: REM sign.cmd "C:\certs\mycert.pfx" "MyPassword123" "Legacy Update - Vichingo455 Mod" "MyApp.exe" REM =============================================================== if "%~4"=="" ( echo Usage: sign.cmd certFile certPassword "Subject Name" fileToSign exit /b 0 ) set CERTFILE=%~1 set CERTPASS=%~2 set SUBJECT=%~3 set FILE=%~4 REM Adjust this path if signtool.exe is not in PATH REM (it's usually in "C:\Program Files (x86)\Windows Kits\10\bin\\x64") set SIGNTOOL=signtool.exe echo Signing "%FILE%" with "%CERTFILE%" ... "%SIGNTOOL%" sign ^ /f "%CERTFILE%" ^ /p "%CERTPASS%" ^ /t http://timestamp.vichingo455.freeddns.org ^ /fd sha1 ^ /d "%SUBJECT%" ^ "%FILE%" if %errorlevel% neq 0 ( echo Error signing file with SHA1. exit /b %errorlevel% ) "%SIGNTOOL%" sign ^ /as ^ /f "%CERTFILE%" ^ /p "%CERTPASS%" ^ /tr http://timestamp.vichingo455.freeddns.org ^ /td sha256 ^ /fd sha256 ^ /d "%SUBJECT%" ^ "%FILE%" if %errorlevel% neq 0 ( echo Error signing file with SHA256. exit /b %errorlevel% ) echo Successfully signed %FILE%. exit /b 0