本文使用的工具都是 Windows SDK 自带的,可以采用单独安装 Windows SDK的方式,也可以通过安装 Visual Studio 来附带安装 Windows SDK。

1
2
3
4
5
6
# 在弹出界面设置密码123456
makecert.exe -sv test.pvk -r -n "CN=test.com" test.cer

cert2spc.exe test.cer test.spc

pvk2pfx.exe -pvk test.pvk -pi 123456 -spc test.spc -pfx test.pfx -f

使用 SignTool 工具对 EXE 文件签名:

1
signtool.exe sign /f test.pfx /p 123456 Setup.exe