【问题标题】:Sign and timestamp manifest files on seperate machines using mage.exe使用 mage.exe 在不同的机器上签名和时间戳清单文件
【发布时间】:2021-08-27 05:44:16
【问题描述】:

我的用例是这样的:我希望能够在“气隙”计算机上签署 EXE 和清单,然后在连接互联网的计算机上添加时间戳:

使用signtool.exe 可以做到这一点。我遇到的问题是mage.exe。它似乎无法单独签名然后为签名加上时间戳,这似乎很奇怪。

我尝试了以下方法:

mage.exe -Sign "myapp.exe.manifest" -CertHash %HASH%
mage.exe -Update "myapp.exe.manifest" -TimestampUri http://timestamp.comodoca.com

在签名步骤之后,我可以检查清单并清楚地看到它已被签名。 但是,更新步骤会完全删除签名。

如果我这样做

mage.exe -Sign "myapp.exe.manifest" -CertHash %HASH% -TimestampUri http://timestamp.comodoca.com

它工作正常,清单已签名并加时间戳

签名和带时间戳的清单之间的唯一区别毫无疑问是时间戳信息。

那么,问题是,是否可以使用 mage.exe 签署清单,然后以 signtool.exe 允许的方式添加时间戳?

提前非常感谢, 詹姆斯

编辑:我还没有尝试但会做的一件事是...... 如果 signtool.exe 可以单独执行此操作,大概它不需要用于签署二进制文件的原始私钥,因此这意味着时间戳不需要私钥,我认为这是有道理的,因为时间戳是“冻结”数字签名,只有公共证书,我可以自己生成并手动将其添加到清单中吗?

【问题讨论】:

    标签: .net windows clickonce signtool mage


    【解决方案1】:

    时间戳是您文件的一部分,当您添加时间戳时:

    ->文件内容改变了,

    ->文件的签名被改变了

    ->你必须退出你的应用程序。

    1. 什么是“标志”
        digest_fun(file_to_sign) -> publisher_digest_of_file
        sign_fun(publisher_digest_of_file, private_key) -> publisher_signature
    
    1. 如何验证“签名”
        digest_fun(file_to_sign) -> digest_of_file
        sign_fun(publisher_signature, public_key) -> publisher_digest_of_file
        assert_fun(digest_of_file == publisher_digest_of_file)
        //if anyone change the content of the file, it fails
    
    1. “时间戳+符号”的作用
        digest_fun(file_to_sign + timestamp) -> publisher_digest_of_file_and_timestamp
        sign_fun(publisher_digest_of_file_and_timestamp, private_key) -> publisher_signature
    
    1. 如何验证“时间戳+签名”
        digest_fun(file_to_sign + timestamp) -> digest_of_file_and_timestamp
        sign_fun(publisher_signature, public_key) -> publisher_digest_of_file_and_timestamp
        assert(digest_of_file_and_timestamp == publisher_digest_of_file_and_timestamp)
        //if anyone change the content of the file, it fails
        //if anyone change the timestamp, it fails
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-02-14
      • 1970-01-01
      • 2019-07-12
      • 1970-01-01
      • 2014-02-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多