PDA

View Full Version : Code Signing Problem Help - SignCode.exe Test Batch file



NewsArchive
04-02-2007, 03:00 AM
Lee,

Attached is a BAT file I made to test the signing process and let you see the
error messages returned by signcode.exe. These can be cryptic by if you Google
them you'll ususally find the solution.

Edit the file and fill in the parameters by copying and pasting from SB so you
have the _exact_ values.

Rem ------------- Fill in these Parameters --------------
Set Sign_SignCodeExe=V:\Build\Signing\SIGNCODE.EXE
Set Sign_Name=Your Name Here
Set Sign_URL=www.Your.com
Set Sign_SPC=V:\Build\Signing\YourCredentials.spc
Set Sign_PVK=V:\Build\Signing\YourPrivateKey.pvk

Set Sign_Tim=http://timestamp.verisign.com/scripts/timstamp.dll
Rem The Time DLL is probably case sensitive and typically all lower case
Rem Verisign: http://timestamp.verisign.com/scripts/timstamp.dll
Rem Comodo: http://timestamp.comodoca.com/authenticode

rem The name of the file you want to sign, typically Setup.exe
Set Sign_SetupExe=setup.exe

Rem ------------- End Fill in Parameters --------------



--------------------------------------------------------------------------------


@rem All of the paramaters used in this file need to be inserted at generation time
@echo off

Rem Fill these in by pasting from your SB screens (paste so you are sure they are identical)
Rem If file names have spaces in them you may need to wrap them in "quotes"
Rem If you have _everything_ identical then maybe you have the wrong password in SB
Rem SignCode is installed into the SB6 \Lib subfolder so maybe you want to have
rem SET Sign_SignCodeExe="c:\program files\linder\setupbuilder6\signcode.exe"

Rem ------------- Fill in these Parameters --------------
Rem """""""""""""""""" Put "Quotes" around file names with spaces """"""""""""""""""
Set Sign_SignCodeExe=V:\Build\Signing\SIGNCODE.EXE
Set Sign_Name=Your Name Here
Set Sign_URL=www.Your.com
Set Sign_SPC=V:\Build\Signing\YourCredentials.spc
Set Sign_PVK=V:\Build\Signing\YourPrivateKey.pvk

Set Sign_Tim=http://timestamp.verisign.com/scripts/timstamp.dll
Rem The Time DLL is probably case sensitive and typically all lower case
Rem Verisign: http://timestamp.verisign.com/scripts/timstamp.dll
Rem Comodo: http://timestamp.comodoca.com/authenticode

rem The name of the file you want to sign, typically Setup.exe
Set Sign_SetupExe=setup.exe

Rem ------------- End Fill in Parameters --------------

echo+
echo+
Echo Test Signing Parameters specified in Setup Builder
echo+
Echo EXE to Sign: %Sign_SetupExe%
Echo Common Name: %Sign_Name%
Echo URL: %Sign_URL%
Echo SignCode.exe: %Sign_SignCodeExe%
Echo TimeStamp URL: %Sign_Tim%
Echo Credentials File: %Sign_SPC%
Echo Private Key: %Sign_PVK%
echo+

Rem check if the file to be signed exists, no sense failing due to that
IF exist %Sign_SetupExe% goto :ExeOk
Echo %Sign_SetupExe% does not exist so it cannot be signed
Echo Build your project then run the sign test again
goto :endit

:ExeOk

Rem check if the other required files exist, let the SignCode run any way
IF Not exist %Sign_SPC% Echo Can't find SPC File? %Sign_SPC%
IF Not exist %Sign_PVK% Echo Can't find PVK File? %Sign_PVK%
IF Not exist %Sign_SignCodeExe% Echo Can't find SignCOde.exe? %Sign_SignCodeExe%

Echo Signing.....%Sign_SignCodeExe% /n "%Sign_Name%" /i "%Sign_URL%" /spc %Sign_SPC% /v %Sign_PVK% /t %Sign_Tim% %Sign_SetupExe%
@echo on
%Sign_SignCodeExe% /n "%Sign_Name%" /i "%Sign_URL%" /spc %Sign_SPC% /v %Sign_PVK% /t %Sign_Tim% %Sign_SetupExe%
@echo off
echo+

IF not errorlevel 1 goto :endIt
Echo Signing failed with error %ErrorLevel%
Echo For help Google the return messages. The below sites have troubleshooting FAQs
Echo http://www.verisign.com/support/code-signing-support/index.html
Echo http://www.thawte.com/ssl-digital-certificates/technical-support/code/msauth.html

rem IF NOT errorlevel 1 Echo Signing appears to have worked without error

:endit
echo+
pause

NewsArchive
04-02-2007, 10:49 AM
Hi Carl,

Thanks for the information. I will keep it on hand for any future problems.

It turns out I received bad information when I contacted Comodo in Feb. I
was told my certificate didn't expire until 2008 so didn't even consider
that as a problem. They LIED.....

--
Regards,

Lee
http://www.cya2day.com