如何部署自己的Authenticode时间戳服务?

时间:2012-06-27 19:33:35

标签: c# dll code-signing trusted-timestamp

我想用我自己的Authenticode时间戳服务为我的DLL文件加上时间戳。这可能吗?我怎么能做到这一点?

5 个答案:

答案 0 :(得分:6)

您需要编写自定义HTTP时间戳服务器。它应遵循RFC 3161时间戳协议(TSP)规则。

当您使用Windows SDK中的Signtool.exe工具为您的DLL签署authenticode时,您可以指定时间戳服务器的URL(使用/ t swich。另请参阅/ tr和/ td)。然后,您将指向您的服务器。

请点击此处查看相关问题:Trusted Timestamps - understanding the format (rfc3161)

还有:Alternative timestamping services for Authenticode

答案 1 :(得分:5)

您可以开发自己的时间戳服务。您可以编写TSP(RFC 3161)服务器,但Authenticode不使用RFC 3161,而是使用MSDN article中描述的PKCS#7 / PKCS#9格式(您也可以实现)。我们的SecureBlackbox组件包括支持两种格式的时间戳服务器组件。更新:Authenticode的最新更新使用标准RFC 3161时间戳。

但问题是获取您将用于签署时间戳的证书。此证书必须由其中一个CA颁发,据我所知,对运行时间戳服务器的管理和基础结构方面存在严格要求。特别是您需要一个安全的时间戳硬件。我没有深入研究这个问题,但这些方面比编写一段代码要复杂得多。

如果您运行自己的PKI基础架构(拥有自己的受信任的根证书和CA证书),那么自动解决拥有可信时间戳证书的问题 - 您可以生成自己的证书。

答案 2 :(得分:2)

You can set up your own Time-stamping Authority (TSA) supporting Authenticode time-stamps (and/or RFC#3161) using SignServer.

See https://www.signserver.org for the download and the installation instructions. In summary the important steps are:

  1. Make sure you have the pre-requisites:

    • Java
    • An application server (i.e. WildFly)
    • Apache Ant for deploying
  2. Download the 4.0 release from https://signserver.org or https://sourceforge.net/projects/signserver/files/signserver/4.0/ .

  3. Configure application server

    • For HTTPS (optional)
    • To make web services work
    • Patch with the latest security fixes
  4. Configure SignServer deployment

    • Set database.name=nodb and database.nodb.location=/an/empty/folder/as/db in conf/signserver_deploy.properties
  5. Deploy SignServer

    • export APPSRV_HOME=/opt/wildfly-9/
    • bin/ant deploy
    • Start application server /opt/wildfly-9/bin/standalone.sh
  6. Check that server started

    • bin/signserver getstatus brief all
  7. Setup a crypto token

    • bin/signserver setproperties doc/sample-configs/keystore-crypto-configuration.properties
    • bin/signserver reload 1
    • bin/signserver getstatus brief all
  8. Setup a sample time-stamp signer

    • bin/signserver setproperties doc/sample-configs/qs_timestamp_configuration.properties
    • bin/signserver reload 2
    • bin/signserver getstatus brief all
  9. Test the time-stamp signer

答案 3 :(得分:1)

假设您希望将其用于测试,如果您乐意将signtool.exe与/ tr开关一起使用,则不必查看RFC,因为openssl为您实现了足够的功能。只需用您喜欢的语言编写HTTP POST处理程序,将发布的数据传递给" openssl ts -reply"逐字,发回openssl TS响应数据。这足以愚弄" signtool.exe verify / pa",即使它没有严格遵循RFC。

编辑:开源Java Signserver项目似乎为您提供了一个服务器处理MSauthenticode(/ t)和rfc3161(/ tr)开箱即用的时间戳。 Signserver的配置对我来说涉及太多的依赖关系,所以我反而攻击了MSAuthenticode时间戳的单元测试,将小型HTTP服务器连接到测试用例,并且几乎没有工作 - 我的Java技能充其量只是平庸 - 有一个正在运行的authenticode时间戳用于开发的服务器,并验证了这样创建的时间戳不是主题this issue。我无法发布源代码,但是按照这个提示应该能让你快速完成工作。

答案 4 :(得分:0)

https://PKIaaS.io 提供符合 RFC 3161 和 Microsoft Authenticode 的时间戳服务器。在站点上创建证书颁发机构后,它会在“CA 服务 URL”列表中显示时间戳 URL,时间戳请求可以发送到该 URL 以进行签名。