You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Signtool /ds签名时出现Error 0x80090027错误求助

SignTool /ds签名时出现0x80090027错误的问题分析

问题描述

使用/ds命令签名摘要文件时出现以下错误:

Done Adding Additional Store

SignTool Error: SignedCode::Sign returned error: 0x80090027

The parameter is incorrect. SignTool Error: An error occurred while attempting to sign: .\installer.exe.dig

Number of errors: 1

复现步骤

通过OpenSSL生成两层ECC secp256r1证书结构:

  • 根CA证书
  • 由根CA签名的代码签名证书(密钥用途为数字签名,增强型密钥用途为代码签名)
    证书导出为.crt格式,完整链导出为.p12格式。执行以下步骤签名可执行文件:
  1. 移除原有签名:
signtool remove /s .\installer.exe
  1. 生成待签名的摘要文件:
signtool sign /fd SHA256 /f .\code_signing.crt /dg . .\installer.exe
  1. 签名摘要文件:
signtool sign /f .\code_signing_chain.p12 /p 1234 /fd SHA256 /ds .\installer.exe.dig

预期行为

成功签署摘要文件,生成可导入至.exe的.dig.signed文件。

实际行为

执行步骤3时出现上述错误,完整调试输出:

The following certificates were considered:
 Issued to: Code Signing
 Issued by: Root CA
 Expires:   Fri Jun 12 13:40:55 2026
 SHA1 hash: 23CDFBE9A6E02BB9419881EDBA5DFA9A81A02D2D

 Issued to: Root CA
 Issued by: Root CA
 Expires:   Wed Jun 12 13:16:07 2030
 SHA1 hash: 0C26C9CBE859B470A3D6A6D571A7619C94C496EC

 After EKU filter, 2 certs were left.
 After expiry filter, 2 certs were left.
 After Private Key filter, 1 certs were left.
 The following certificate was selected:
 Issued to: Code Signing
 Issued by: Root CA
 Expires:   Fri Jun 12 13:40:55 2026
 SHA1 hash: 23CDFBE9A6E02BB9419881EDBA5DFA9A81A02D2D

 Done Adding Additional Store
 SignTool Error: SignedCode::Sign returned error: 0x80090027
     The parameter is incorrect.
 SignTool Error: An error occurred while attempting to sign: .\installer.exe.dig

 Number of files successfully Signed: 0
 Number of warnings: 0
 Number of errors: 1

额外上下文

使用Microsoft SDK 10.0A

问题根源及修复

问题出在步骤2:生成摘要时错误指定了无密钥的证书

/dg参数的作用是生成待签名的摘要文件,这一步不需要指定签名证书(/f参数)——因为生成摘要仅需计算文件哈希,不需要关联公钥或私钥。

你在步骤2中使用了/f .\code_signing.crt,而该文件仅包含公钥(无对应私钥),这会导致SignTool生成的.dig文件包含错误的元数据,最终在步骤3签名时触发0x80090027参数错误。

修复步骤

修改步骤2的命令,移除多余的/f参数:

signtool sign /fd SHA256 /dg . .\installer.exe

额外优化:步骤1的命令修正

signtool remove命令中/s参数用于指定系统证书存储,若要移除文件中的签名,正确用法应为:

signtool remove .\installer.exe

内容的提问来源于stack exchange,提问作者user21986447

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.12 22:23:18