簡體   English   中英

Nuget:此包已簽名但不是由受信任的簽名者簽名

[英]Nuget: This package is signed but not by a trusted signer

我需要你的幫助。

我的配置:

  • Visual Studio 社區 2019
  • 視窗 10 x64 1909

我想使用 nuget 下載軟件包,但我總是遇到這個該死的錯誤(見標題)。

我的解決方案文件夾的結構:

  • D:\\MySln\\
    • 配置文件
    • nuget_packages
    • 你好,世界\\
    • 你好太陽\\

我的 nuget.config 文件: https ://docs.microsoft.com/en-us/nuget/reference/nuget-config-file

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <config>
    <!--
        Used to specify the default location to expand packages.
        See: nuget.exe help install
        See: nuget.exe help update

        In this example, %PACKAGEHOME% is an environment variable.
        This syntax works on Windows/Mac/Linux
    -->
       <add key="repositoryPath" value=".\nuget_packages" />

    <!--
        Used to specify default source for the push command.
        See: nuget.exe help push
    -->
        <!--
        <add key="defaultPushSource" value="https://MyRepo/ES/api/v2/package" />
    -->

    <!-- Proxy settings -->
        <add key="http_proxy" value="host" />
        <add key="http_proxy.user" value="username" />
        <add key="http_proxy.password" value="encrypted_password" />
    </config>

    <packageRestore>
    <!-- Allow NuGet to download missing packages -->
        <add key="enabled" value="True" />

    <!-- Automatically check for missing packages during build in Visual Studio -->
        <add key="automatic" value="True" />
    </packageRestore>

<!--
    Used to specify the default Sources for list, install and update.
    See: nuget.exe help list
    See: nuget.exe help install
    See: nuget.exe help update
-->
    <packageSources>
        <add key="NuGet official package source" value="https://api.nuget.org/v3/index.json" />
        <!--
        <add key="MyRepo - ES" value="https://MyRepo/ES/nuget" />
        -->
    </packageSources>

<!-- Used to store credentials -->
    <packageSourceCredentials />

<!-- Used to disable package sources  -->
    <disabledPackageSources />

<!--
    Used to specify default API key associated with sources.
    See: nuget.exe help setApiKey
    See: nuget.exe help push
    See: nuget.exe help mirror
-->
    <apikeys>
        <add key="https://MyRepo/ES/api/v2/package" value="encrypted_api_key" />
   </apikeys>

<!--
    Used to specify trusted signers to allow during signature verification.
    See: nuget.exe help trusted-signers
-->
    <trustedSigners>
        <author name="microsoft">
            <certificate fingerprint="3F9001EA83C560D712C24CF213C3D312CB3BFF51EE89435D3430BD06B5D0EECE" hashAlgorithm="SHA256" allowUntrustedRoot="false" />
        </author>
        <repository name="nuget.org" serviceIndex="https://api.nuget.org/v3/index.json">
            <certificate fingerprint="0E5F38F57DC1BCC806D8494F4F90FBCEDD988B46760709CBEEC6F4219AA6157D" hashAlgorithm="SHA256" allowUntrustedRoot="false" />
            <owners>microsoft;aspnet;nuget</owners>
        </repository>
    </trustedSigners>
</configuration>

無論是使用 nuget cli 還是使用 Visual Studio Nuget 包管理器,我總是遇到該錯誤。

感謝您的幫助 !

nuget.config 的末尾有trustedSigners部分,它說只信任:

  • 由 Microsoft 的簽名證書簽名的包。 不信任其他軟件包作者。
  • 只信任來自 nuget.org 的包,沒有其他來源
    • 來自 nuget.org,僅信任 microsoft、aspnet 和 nuget 帳戶擁有的包

任何其他包(例如 newtonsoft.json、xunit、nunit 等)都不會被信任,因為它不符合此標准。

如果您不是在必須非常嚴格地管理“安全供應鏈”的環境中工作,您可以從 nuget.config 中刪除整個trustedSigners部分。

根據您想要實現的目標(為什么首先啟用受信任的簽名者), 鎖定文件可能是一種不太嚴格的方法,可以降低 CI 機器使用與您在自己的 devbox 上使用的軟件包不同的軟件包的風險。

有關受信任簽名者的更多文檔: https : //docs.microsoft.com/en-us/nuget/consume-packages/installing-signed-packages

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM