VSTO Excel加载项证书过期后即使加时间戳仍无法加载的解决方法
故障场景与基本现象
- 项目技术栈:基于WPF协同开发的VSTO Excel加载项,开发环境为Visual Studio 2017。
- 代码签名配置:使用有效期至2021年6月23日的pfx格式证书,对全部项目产物(独立exe程序、加载项dll、msi安装包、自定义安装引导程序)完成代码签名,签名时通过Digicert服务添加时间戳。
- 原理预期:按照技术设计逻辑,添加合法时间戳的代码签名,即使后续签名证书过期,也应当正常通过系统签名校验、保障程序可正常运行。
- 实际故障表现:将系统时间调整至证书过期日期之后模拟过期场景时,VSTO加载项完全无法加载,加载失败的报错界面可参考VSTO加载项加载失败报错截图。
- 已有排查动作:参考微软开发者社区同主题排障指引执行调整未生效,先后尝试了三类不同的signtool签名参数组合。
已尝试的三类签名参数配置
配置1
仅对独立exe程序执行签名,使用RFC3161 SHA256时间戳参数:
signtool sign /f mycertpfx.pfx /p passwd /tr http://timestamp.digicert.com/?alg=sha256 /td sha256 /fd sha256 /d "myexe.exe"
配置2
对四类产物逐文件执行签名,使用传统SHA1时间戳参数:
signtool sign /t http://timestamp.digicert.com /f "mycertpfx.pfx" /p passwdr "myexe.exe" signtool sign /t http://timestamp.digicert.com /f "mycertpfx.pfx" /p passwdr "myaddin.dll" signtool sign /t http://timestamp.digicert.com /f "mycertpfx.pfx" /p passwdr "mymsi.msi" signtool sign /t http://timestamp.digicert.com /f "mycertpfx.pfx" /p passwdr "myinstaller.exe"
配置3
对四类产物逐文件执行签名,使用RFC3161 SHA256时间戳参数:
signtool sign /tr http://timestamp.digicert.com /td sha256 /fd sha256 /f "mycertpfx.pfx" /p passwdr "myexe.exe" signtool sign /tr http://timestamp.digicert.com /td sha256 /fd sha256 /f "mycertpfx.pfx" /p passwdr "myaddin.dll" signtool sign /tr http://timestamp.digicert.com /td sha256 /fd sha256 /f "mycertpfx.pfx" /p passwdr "mymsi.msi" signtool sign /tr http://timestamp.digicert.com /td sha256 /fd sha256 /f "mycertpfx.pfx" /p passwdr "myinstaller.exe"
核心需求
- 定位上述签名校验失败的根本原因,输出可直接落地的解决方案
- 总结一套可稳定复现的验证流程,用于测试基于ClickOnce发布的VSTO Excel加载项在签名证书过期场景下的运行状态,验证过程采用调整系统时间的方式模拟证书过期环境
内容的提问来源于stack exchange,提问作者sudeep
相关产品推荐
相关产品推荐

