来自 Azure.Identity 包的 Nuget NU3034

问题描述 投票:0回答:1

在 WSL2(Windows 上的 Ubuntu)上构建 dotnet core 8.0.204。

我们最近升级到使用 1.11.0 版的包

Azure.Identity
(以及其他一些包),我遇到了这个非常持久的错误:

$ dotnet restore
  Package 'Azure.Identity 1.11.0' from source 'https://api.nuget.org/v3/index.json':   Subject Name: CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
  Package 'Azure.Identity 1.11.0' from source 'https://api.nuget.org/v3/index.json':   SHA256 hash: 566A31882BE208BE4422F7CFD66ED09F5D4524A5994F50CCC8B05EC0528C1353
  Package 'Azure.Identity 1.11.0' from source 'https://api.nuget.org/v3/index.json':   Valid from: 07/27/2023 01:00:00 to 10/18/2026 00:59:59
/home/richard/myproj/myproj.csproj : error NU3034: Package 'Azure.Identity 1.11.0' from source 'https://api.nuget.org/v3/index.json': This package was not repository signed with a certificate listed by this repository.

但是我已经注册了指纹:

$ dotnet nuget trust list
Registered trusted signers:

 1.   Microsoft [author]
      Certificate fingerprint(s):
        SHA256 - 566A31882BE208BE4422F7CFD66ED09F5D4524A5994F50CCC8B05EC0528C1353

我的基本

NuGet.Config
(在项目的文件夹中)是:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
  </packageSources>

  <trustedSigners>
    <author name="Microsoft">
      <certificate fingerprint="3F9001EA83C560D712C24CF213C3D312CB3BFF51EE89435D3430BD06B5D0EECE" hashAlgorithm="SHA256" allowUntrustedRoot="false" />
      <certificate fingerprint="AA12DA22A49BCE7D5C1AE64CC1F3D892F150DA76140F210ABD2CBFFCA2C18A27" hashAlgorithm="SHA256" allowUntrustedRoot="false" />
      <certificate fingerprint="566A31882BE208BE4422F7CFD66ED09F5D4524A5994F50CCC8B05EC0528C1353" hashAlgorithm="SHA256" allowUntrustedRoot="false" />
    </author>
  </trustedSigners>

  <config>
    <add key="signatureValidationMode" value="accept" />
  </config>
</configuration>

...虽然我有很多变化并将相同的内容也放入

~/.nuget/NuGet/NuGet.Config
中。

我尝试了各种方法,包括

nuget config -set signatureValidationMode=accept
并在系统中搜索其他
NuGet.Config
文件。

如果我恢复到软件包的早期版本,我不会收到此错误,但会收到

known vulnerability
错误,因此不确定以前的版本是否未签名,或者漏洞错误是否优先于签名错误显示.

我已经阅读了这里的所有文章和谷歌上的其他文章 - 大多数关于 NU3034 的错误措辞都是不同的 - “不是由受信任的签名者”而不是“不是使用此存储库列出的证书签名的存储库”。

.net .net-core nuget wsl-2
1个回答
0
投票

一位同事(通过 ChatGPT!)告诉我运行这个解决了问题:

dotnet nuget locals all --clear
© www.soinside.com 2019 - 2024. All rights reserved.