更新证书后是否需要重新编码 sign Excel 宏
Do I need to re-code sign Excel macros after renewing the certificate
几年前,我在 Excel 中创建了 20 到 30 个表单,外加一个 Excel 插件来处理这些表单。表单和加载项包含 VBA 代码,我们使用 Go Daddy 的证书对这些代码进行了编码签名。证书本月到期,公司要求我帮助他们完成任何需要做的事情,以确保表格仍然有效,并且不会提示企业用户信任宏。
证书将通过原始提供商 GoDaddy 续订。
我是否需要在每个文件中对 VBA 项目重新进行代码签名,或者代码签名是否足够智能,可以意识到证书已更新并仍然使用它?看来,最坏的情况,我将不得不打开每个 VBA 项目并重新签署代码,保存文件,然后将它们重新部署到用户在使用它们时打开表单的服务器.
我可能可以通过反复试验来解决这个问题,但我已经不在公司工作了,下周去办公室之前我无法访问表格和证书。不过,我想做好准备,所以任何 re-signing/re-deploying 都需要尽可能少的时间。
谢谢!
您很可能必须重新签署所有文件,因为签署本质上是在说 "This code is approved by the creator tied to the accompanying certificate, as attested by this trustworthy company"。由于证书过期,您不能继续使用同一个证书。这是为了防止有人在废弃的硬盘驱动器或其他任何地方找到旧证书并使用假名签署代码。
但是,您应该做的是 "Timestamping" 您的代码签名请求。为您的代码添加时间戳有效地表示 "This code is approved by the creator at this moment in time and hasn't changed since"。但是,为了给 VBA 项目添加时间戳,您需要手动启用相关外部服务,因此您需要互联网。
Godaddy 的这篇文章中解释了该过程:
If you would like to allow people to continue using your signed Visual Basic® for Applicaions (VBA) code after the certificate expires, modify the registry on your code-signing computer to add a time stamp at the time of signing using the following keys:
- Create Key: HKEY_CURRENT_USER\Software\Microsoft\VBA\Security
- Create String: HKEY_CURRENT_USER\Software\Microsoft\VBA\Security\TimeStampURL
- Create DWORD: HKEY_CURRENT_USER\Software\Microsoft\VBA\Security\TimeStampRetryCount
- Create DWORD: HKEY_CURRENT_USER\Software\Microsoft\VBA\Security\TimeStampRetryDelay
Set the new fields to these values:
- TimeStampURL = http://tsa.starfieldtech.com
- TimeStampRetryCount = 3
- TimeStampRetryDelay = 2
之后:
To Code Sign Documents
- Open the file you want to sign.
- Click the Tools menu, highlight Macro and click Visual Basic Editor.
- In the Project Explorer window, select the VBA macro project that you want to sign.
- From the Tools menu, select Digital Signature.
- Click Choose and select your Code Signing Certificate.0
- Click OK to close.
此过程应该允许您在证书过期后继续使用 VBA 宏。
几年前,我在 Excel 中创建了 20 到 30 个表单,外加一个 Excel 插件来处理这些表单。表单和加载项包含 VBA 代码,我们使用 Go Daddy 的证书对这些代码进行了编码签名。证书本月到期,公司要求我帮助他们完成任何需要做的事情,以确保表格仍然有效,并且不会提示企业用户信任宏。
证书将通过原始提供商 GoDaddy 续订。
我是否需要在每个文件中对 VBA 项目重新进行代码签名,或者代码签名是否足够智能,可以意识到证书已更新并仍然使用它?看来,最坏的情况,我将不得不打开每个 VBA 项目并重新签署代码,保存文件,然后将它们重新部署到用户在使用它们时打开表单的服务器.
我可能可以通过反复试验来解决这个问题,但我已经不在公司工作了,下周去办公室之前我无法访问表格和证书。不过,我想做好准备,所以任何 re-signing/re-deploying 都需要尽可能少的时间。
谢谢!
您很可能必须重新签署所有文件,因为签署本质上是在说 "This code is approved by the creator tied to the accompanying certificate, as attested by this trustworthy company"。由于证书过期,您不能继续使用同一个证书。这是为了防止有人在废弃的硬盘驱动器或其他任何地方找到旧证书并使用假名签署代码。
但是,您应该做的是 "Timestamping" 您的代码签名请求。为您的代码添加时间戳有效地表示 "This code is approved by the creator at this moment in time and hasn't changed since"。但是,为了给 VBA 项目添加时间戳,您需要手动启用相关外部服务,因此您需要互联网。
Godaddy 的这篇文章中解释了该过程:
If you would like to allow people to continue using your signed Visual Basic® for Applicaions (VBA) code after the certificate expires, modify the registry on your code-signing computer to add a time stamp at the time of signing using the following keys:
- Create Key: HKEY_CURRENT_USER\Software\Microsoft\VBA\Security
- Create String: HKEY_CURRENT_USER\Software\Microsoft\VBA\Security\TimeStampURL
- Create DWORD: HKEY_CURRENT_USER\Software\Microsoft\VBA\Security\TimeStampRetryCount
- Create DWORD: HKEY_CURRENT_USER\Software\Microsoft\VBA\Security\TimeStampRetryDelay
Set the new fields to these values:
- TimeStampURL = http://tsa.starfieldtech.com
- TimeStampRetryCount = 3
- TimeStampRetryDelay = 2
之后:
To Code Sign Documents
- Open the file you want to sign.
- Click the Tools menu, highlight Macro and click Visual Basic Editor.
- In the Project Explorer window, select the VBA macro project that you want to sign.
- From the Tools menu, select Digital Signature.
- Click Choose and select your Code Signing Certificate.0
- Click OK to close.
此过程应该允许您在证书过期后继续使用 VBA 宏。