Code Signing

From SkyWiki

(Difference between revisions)
Jump to: navigation, search
m
m
Line 10: Line 10:
set PFX=C:\PATH\NAME.pfx
set PFX=C:\PATH\NAME.pfx
set TimeURL=http://timestamp.verisign.com/scripts/timstamp.dll
set TimeURL=http://timestamp.verisign.com/scripts/timstamp.dll
 +
# create certificate files
# create certificate files
 +
makecert -r -n "%NAME%" -sv "%PVK%" %CER%
makecert -r -n "%NAME%" -sv "%PVK%" %CER%
cert2spc %CER% %SPC%
cert2spc %CER% %SPC%
pvk2pfx -pvk %PVK% -spc %SPC% -pfx %PFX% -f
pvk2pfx -pvk %PVK% -spc %SPC% -pfx %PFX% -f
 +
# sign the executable file "BINARY.exe" (or ZIP file or what ever)
# sign the executable file "BINARY.exe" (or ZIP file or what ever)
 +
signtool sign -f %PFX% -t "%TimeURL%" -v "BINARY.exe"
signtool sign -f %PFX% -t "%TimeURL%" -v "BINARY.exe"
 +
# display and verify the signature information
# display and verify the signature information
 +
signtool.exe verify /v /a "%File%"
signtool.exe verify /v /a "%File%"
</pre>
</pre>
[[category:remember]]
[[category:remember]]

Revision as of 19:46, 18 September 2008

How to create a private self-signed software certificate and use it to sign a binary file.

# setup input variables

set NAME=CN=SURNAME NAME,O=SURNAME NAME,E=EMAIL@XYZ.COM
set CER=C:\PATH\NAME.cer
set PVK=C:\PATH\NAME.pvk
set SPC=C:\PATH\NAME.spc
set PFX=C:\PATH\NAME.pfx
set TimeURL=http://timestamp.verisign.com/scripts/timstamp.dll


# create certificate files

makecert -r -n "%NAME%" -sv "%PVK%" %CER%
cert2spc %CER% %SPC%
pvk2pfx -pvk %PVK% -spc %SPC% -pfx %PFX% -f


# sign the executable file "BINARY.exe" (or ZIP file or what ever)

signtool sign -f %PFX% -t "%TimeURL%" -v "BINARY.exe"


# display and verify the signature information

signtool.exe verify /v /a "%File%"
Personal tools