错误 - Install-Package : Authenticode issuer 'System.Object[]' 在本地包存储库上运行 Update-Module 时 [英] Error - Install-Package : Authenticode issuer 'System.Object[]' when running Update-Module on local package repository

查看:62
本文介绍了错误 - Install-Package : Authenticode issuer 'System.Object[]' 在本地包存储库上运行 Update-Module 时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已经为本地生产的工作工具建立了一个 Nuget 风格的包存储库.这是通过文件共享完成的.但是,我尝试更新的模块抛出了一个关于旧版本的验证码签名与新版本的发布者不匹配的错误.

We've set up a Nuget style package repository for our locally produced tools at work. This is done via a file share. However, the module that I am attempting to update is throwing an error about the authenticode signature of the old version not matching the publisher of the new version.

  1. 签名证书来自我们的 AD PKI 系统并且是可信的,它没有改变/没有以任何方式改变.

  1. The signing certificate is from our AD PKI system and is trusted and it does not change/has not changed in any way.

显然使用 -SkipPublisherCheck 是一个可行的解决方法,但这不是一个长期的解决方案.

Obviously using -SkipPublisherCheck is a viable workaround but that is not a long-term solution.

我在初始安装软件包时没有收到任何错误或警告.仅在执行更新时.

I receive no errors or warnings on the initial installation of the package. Only when performing the update.

在签名机器上只有 3 个证书,并且所有三个都在 LocalMachine 存储中.他们没有相同的主题(这在我通过 Google 找到的某些网站上被提及为可能的原因)

On the signing machine there are only 3 certificates and all three are in the LocalMachine store. They do not have the same subject (this is mentioned as a possible cause on some sites I found via Google)

代码

$cert = get-ChildItem Cert:\LocalMachine\My\5B3B66061B02EBF0986CF7969F36C6FB58060046
Set-AuthenticodeSignature "C:\Jenkins\workspace\Scripts - Master\MyModule_Src\dist\MyModule\MyModule.psm1" -Certificate $cert
#... Pester tests
Publish-Module -Name MyModule -Repository ORGPSGet -Verbose -force

<小时>

错误信息

PackageManagement\Install-Package : Authenticode issuer 'System.Object[]' of the new module 'MyModule' with version
'4.0.4' is not matching with the authenticode issuer 'System.Object[]' of the previously-installed module 'MyModule'
with version '4.0.3'. If you still want to install or update, use -SkipPublisherCheck parameter.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2089 char:20
+ ...           $sid = PackageManagement\Install-Package @PSBoundParameters
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exc
   eption
    + FullyQualifiedErrorId : AuthenticodeIssuerMismatch,Validate-ModuleAuthenticodeSignature,Microsoft.PowerShell.Packag
   eManagement.Cmdlets.InstallPackage

推荐答案

根据错误消息,我认为 PowerShell 需要多个证书但未找到签名,或者签名中有多个证书签名和 PowerShell 不喜欢那样.我将 -IncludeChain signer 添加到签名命令中,然后在重新运行构建后,我能够按预期使用 Update-Module 命令.

Based on the error message I assumed that there was something about the signature that PowerShell was either expecting multiple certificates and not finding it or that there were multiple certificates in the signature and PowerShell did not like that. I added -IncludeChain signer to the signing command and then after rerunning the build, I was able to use the Update-Module command as expected.

Set-AuthenticodeSignature "C:\Jenkins\workspace\Scripts - Master\MyModule_Src\dist\MyModule\MyModule.psm1" -Certificate $cert -IncludeChain signer

有关详细信息,请参阅文档.

See the docs for more details.

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.security/set-authenticodesignature?view=powershell-6

这篇关于错误 - Install-Package : Authenticode issuer 'System.Object[]' 在本地包存储库上运行 Update-Module 时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆