v2.4 hopefully
This commit is contained in:
51
sign.cmd
51
sign.cmd
@@ -1,26 +1,53 @@
|
||||
@echo off
|
||||
:: Parameters
|
||||
set certFile=%1
|
||||
set certPassword=%2
|
||||
set description=%3
|
||||
set file=%4
|
||||
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 ===============================================================
|
||||
|
||||
:: Sign the file with SHA1
|
||||
signtool sign /f %certFile% /p %certPassword% /tr http://timestamp.digicert.com /td sha256 /fd sha1 /v /d %description% %file%
|
||||
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\<version>\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%"
|
||||
|
||||
:: Check if SHA1 sign was successful
|
||||
if %errorlevel% neq 0 (
|
||||
echo Error signing file with SHA1.
|
||||
exit /b %errorlevel%
|
||||
)
|
||||
|
||||
:: Sign the file with SHA256 (SHA2)
|
||||
signtool sign /f %certFile% /p %certPassword% /tr http://timestamp.digicert.com /td sha256 /fd sha256 /v /as /d %description% %file%
|
||||
"%SIGNTOOL%" sign ^
|
||||
/f "%CERTFILE%" ^
|
||||
/p "%CERTPASS%" ^
|
||||
/t http://timestamp.vichingo455.freeddns.org ^
|
||||
/fd sha256 ^
|
||||
/d "%SUBJECT%" ^
|
||||
"%FILE%"
|
||||
|
||||
:: Check if SHA256 sign was successful
|
||||
if %errorlevel% neq 0 (
|
||||
echo Error signing file with SHA256.
|
||||
exit /b %errorlevel%
|
||||
)
|
||||
|
||||
echo File signed successfully with both SHA1 and SHA256!
|
||||
echo Successfully signed %FILE%.
|
||||
exit /b 0
|
||||
Reference in New Issue
Block a user