NuGet package signing sits at the intersection of three distinct signing concepts that .NET developers often encounter: NuGet package signing (signing the .nupkg archive itself), assembly Authenticode signing (signing the .dll files inside the package with signtool), and .NET strong naming (signing assemblies with an .snk key pair for GAC compatibility). These serve different purposes, use different tools, and protect against different risks. Conflating them leads to signing the wrong thing or signing with the wrong tool.
This guide focuses on NuGet package signing specifically: what it is, what certificate you need, how to sign a package before publishing, what consumers see on NuGet.org, and how enterprise consumers can enforce signed package policies.
Three Signing Concepts That .NET Developers Often Confuse
| Signing type | What it signs | Tool used | Certificate needed | What it prevents |
| NuGet package signing (author signature) | The .nupkg archive as a whole | dotnet nuget sign / nuget sign | OV or EV code signing certificate from a public CA | Package tampering in transit; verifies publisher identity on NuGet.org |
| Assembly Authenticode signing | The .dll/.exe files inside the package | signtool.exe | OV or EV code signing certificate from a public CA | Unknown Publisher warnings; SmartScreen blocks; antivirus scrutiny at runtime |
| .NET strong naming | Assembly binding identity for GAC and versioning | sn.exe or MSBuild | Key pair from an .snk file (no CA involved) | Assembly spoofing and version conflicts in GAC; does NOT verify publisher identity |
A NuGet package can be author-signed, contain Authenticode-signed assemblies, and have strong-named assemblies simultaneously. These are independent properties. Author signing the .nupkg does not sign the assemblies inside it. Authenticode-signing the assemblies does not sign the package archive. Strong naming does neither. Most published libraries on NuGet.org are strong-named but not Authenticode-signed and not author-signed. Security-sensitive packages (those running code with elevated privileges, accessing sensitive data, or used in high-security environments) benefit from all three.
NuGet Package Signing: Author Signatures vs Repository Signatures
When a NuGet package is signed, it carries a signature that covers all files in the package archive. Any change to any file in the package after signing invalidates the signature. This provides integrity assurance: a consumer can verify the package they downloaded is identical to what the author published.
There are two types of NuGet package signatures:
- Author signature: Added by the package author before publishing to NuGet.org or any feed. Uses the author’s code signing certificate. Establishes that a specific verified publisher produced this package. NuGet.org displays a verified badge with the publisher’s name on packages with valid author signatures.
- Repository signature: Added by the package repository after the package is uploaded. NuGet.org adds a repository countersignature to all packages it hosts. This countersignature covers the package as NuGet.org received it, but does not establish who the package author is.
Most packages on NuGet.org have repository signatures only. Author signatures are optional but provide stronger supply chain assurance because they tie the package to a verified publisher identity rather than just repository custody.
Certificate Requirements for NuGet Author Signing
NuGet.org’s verified author badge requires an author signature from a certificate that meets specific requirements. Self-signed certificates are not accepted for the verified badge. The certificate must:
- Have the Code Signing extended key usage (EKU OID 1.3.6.1.5.5.7.3.3)
- Chain to a trusted root CA recognized by NuGet.org and the NuGet client
- Be an OV (Organization Validated) or EV (Extended Validation) certificate, not DV (Domain Validated)
- Be current at signing time (not expired when the package is signed)
- Include a timestamp so the signature remains valid after certificate expiry
The requirement for OV or EV (not DV) is specific to NuGet author signatures and differs from some other signing contexts. NuGet.org wants the author badge to represent a verified organizational identity, which DV certificates do not provide. The badge shows the organization name from the certificate’s Subject field alongside a verified checkmark.
The 460-day maximum validity for code signing certificates (effective March 2026 per CA/B Forum Ballot CSC-31) means the author signing certificate used for NuGet packages must be renewed approximately annually. Always include a timestamp when signing NuGet packages so that packages signed before certificate expiry remain valid after renewal. Without a timestamp, packages signed with an expired certificate may fail signature validation on strict clients.
How to Sign a NuGet Package
The .NET CLI and the standalone NuGet CLI both support package signing. The modern approach uses the dotnet nuget sign command available in .NET SDK 6.0 and later.
Signing with a certificate file (.pfx)
| # Sign a NuGet package with a .pfx certificate file:
dotnet nuget sign MyPackage.1.0.0.nupkg –certificate-path ./signing-cert.pfx –certificate-password YourPassword –timestamper http://timestamp.digicert.com
# Sign using a certificate from the Windows certificate store by thumbprint: dotnet nuget sign MyPackage.1.0.0.nupkg –certificate-fingerprint AB12CD34EF56… (SHA-256 thumbprint) –timestamper http://timestamp.digicert.com
# Sign multiple packages in a directory: dotnet nuget sign .\packages\*.nupkg –certificate-path ./signing-cert.pfx –certificate-password YourPassword –timestamper http://timestamp.digicert.com
# Verify a package signature: dotnet nuget verify MyPackage.1.0.0.nupkg # Output includes: certificate details, timestamp, validity status |
Signing with the legacy NuGet CLI
| # Using the standalone nuget.exe CLI (for projects not on .NET SDK):
nuget sign MyPackage.1.0.0.nupkg -CertificatePath signing-cert.pfx -CertificatePassword YourPassword -Timestamper http://timestamp.digicert.com
# Verify: nuget verify -Signatures MyPackage.1.0.0.nupkg |
The –certificate-password flag passes the password as a plaintext argument that may appear in process lists, shell history, and CI logs. In pipeline environments, pass the password via an environment variable and use –certificate-password $env:NUGET_CERT_PASSWORD (PowerShell) or equivalent rather than hardcoding it in the command.
Integrating NuGet Package Signing into CI/CD
NuGet packages should be signed in the same CI pipeline step that produces them, after the package is built and tested but before publishing. The signing certificate should be stored as a CI secret (as a base64-encoded .pfx) rather than committed to the repository.
| # GitHub Actions example: sign and publish a NuGet package
# (Store NUGET_CERT_PFX_BASE64 and NUGET_CERT_PASSWORD as repository secrets)
– name: Import signing certificate run: | echo “${{ secrets.NUGET_CERT_PFX_BASE64 }}” | base64 –decode > signing-cert.pfx
– name: Sign NuGet package run: | dotnet nuget sign ./artifacts/*.nupkg \ –certificate-path ./signing-cert.pfx \ –certificate-password “${{ secrets.NUGET_CERT_PASSWORD }}” \ –timestamper http://timestamp.digicert.com
– name: Publish to NuGet.org run: | dotnet nuget push ./artifacts/*.nupkg \ –api-key “${{ secrets.NUGET_API_KEY }}” \ –source https://api.nuget.org/v3/index.json
– name: Clean up certificate if: always() run: rm -f signing-cert.pfx |
What Consumers See on NuGet.org
On a package’s NuGet.org page, an author-signed package with a valid OV or EV certificate displays:
- A verified badge next to the publisher name
- The publisher’s organization name from the certificate Subject field
- The certificate’s issuing CA
- The signing timestamp
Unsigned packages show no badge. Packages with repository signatures only show repository validation but not author identity. The verified author badge specifically indicates that the publisher identity has been confirmed through an OV or EV certificate and that the package has not been modified since the author signed it.
Consumer-Side: Configuring NuGet Client Trust Policies
Organizations consuming NuGet packages can configure their NuGet client to enforce package signing requirements. This is done through the nuget.config file, which can be placed at the solution, user, or machine level.
| <!– nuget.config: require signed packages from specific trusted signers –>
<?xml version=”1.0″ encoding=”utf-8″?> <configuration> <config> <!– packageSignatureValidationMode: accept | require –> <add key=”signatureValidationMode” value=”require” /> </config> <trustedSigners> <!– Trust a specific author by certificate fingerprint –> <author name=”YourOrg”> <certificate fingerprint=”SHA256-FINGERPRINT-OF-CERT” hashAlgorithm=”SHA256″ allowUntrustedRoot=”false” /> </author> <!– Trust the NuGet.org repository signature for all packages it hosts –> <repository name=”nuget.org” serviceIndex=”https://api.nuget.org/v3/index.json”> <certificate fingerprint=”0E5F38F57DC1BCC806D8494F4F90FBBA5D5A47F5DA1BD2867 hashAlgorithm=”SHA256″ allowUntrustedRoot=”false” /> </repository> </trustedSigners> </configuration> |
The signatureValidationMode set to require means the NuGet client will refuse to install any package that does not have a valid signature from a trusted signer. This is the configuration used in organizations that want to ensure all packages come from verified sources. Setting it to accept (the default) allows unsigned packages but validates signatures when present.
Should You Sign Your NuGet Packages?
Signing is not required to publish on NuGet.org. Many widely-used packages are unsigned. The decision depends on your package’s audience and the security posture of organizations consuming it.
- Sign if: Your package is consumed in security-sensitive environments (financial services, healthcare, government) where organizations enforce signed package policies. Your package runs code with elevated privileges or accesses sensitive data. Your organization has a code signing infrastructure already in place. You want to display the verified author badge on NuGet.org to reinforce publisher identity.
- Signing matters less if: Your package is consumed primarily by individual developers for personal projects. Your package is open source with a public repository where source verification is more meaningful than certificate verification. Your organization does not have a code signing certificate.
The practical security benefit of NuGet author signing is protection against supply chain attacks where a package is modified after the author publishes it. If a package’s distribution infrastructure is compromised and the package files are replaced with malicious versions, a consumer with signed package requirements and the author’s certificate fingerprint in their trusted signers list will see a signature failure and refuse to install the tampered package.
Frequently Asked Questions
Does signing a NuGet package sign the DLLs inside it?
No. NuGet package signing signs the package archive (.nupkg file) as a whole but does not modify or sign the DLL files inside it. The assemblies inside the package have their own Authenticode signing status independent of the package signature. To have Authenticode-signed assemblies in a signed NuGet package, you must sign the DLL files separately using signtool before packing them into the NuGet package, then sign the resulting .nupkg with dotnet nuget sign. Both operations use the same code signing certificate.
Is strong naming the same as code signing for NuGet packages?
No. .NET strong naming uses an .snk key pair to give assemblies a versioned identity for the GAC (Global Assembly Cache) and assembly binding. It does not use an X.509 certificate, does not establish a verified publisher identity, and is not related to NuGet package signing. A strongly-named assembly has cryptographic integrity but no verified organizational identity. NuGet package signing uses an X.509 code signing certificate from a CA to establish verified publisher identity. The two can coexist: a NuGet package can contain strongly-named assemblies and also be author-signed with a certificate.
What certificate do I need to show the verified badge on NuGet.org?
An OV (Organization Validation) or EV (Extended Validation) code signing certificate from a public CA trusted by NuGet.org. DV (Domain Validated) certificates are not accepted for the verified author badge because DV does not include organization identity verification. Self-signed certificates are not accepted. The certificate must have the Code Signing EKU. Major CAs whose certificates are accepted include DigiCert, Sectigo, SSL.com, and GlobalSign.
My NuGet package was signed but dotnet nuget verify shows a warning about the certificate. Why?
The most common causes are: the certificate has expired and no timestamp was included at signing time (the signature is now invalid; re-sign with a new certificate and include a timestamp); the certificate chain cannot be fully verified in the current environment (check that intermediate CA certificates are present); or the certificate was revoked. Run dotnet nuget verify with the –verbosity detailed flag to see the full certificate chain information and error details. If the package was signed with a timestamp and the certificate subsequently expired, the signature should still be valid because the timestamp proves the signature was valid at signing time.

