Project

PSPublishModule

Build, test, version, sign, and publish PowerShell modules with reusable PowerForge pipelines.

Stars 48
Forks 16
PowerShell Gallery downloads 17,213
Release v3.0.186
Language: C# Updated: 2026-11-04
Command

Export-CertificateForNuGet

Module
PSPublishModule
Inputs
None
Outputs
PowerForge.NuGetCertificateExportResult

Exports a code-signing certificate to DER format for NuGet.org registration.

Syntax

Export-CertificateForNuGet
-CertificateThumbprint <String>
[-LocalStore <CurrentUser|LocalMachine>]
[-OutputPath <String>]
[<CommonParameters>]
#
Parameter set: Thumbprint
Export-CertificateForNuGet
-CertificateSha256 <String>
[-LocalStore <CurrentUser|LocalMachine>]
[-OutputPath <String>]
[<CommonParameters>]
#
Parameter set: Sha256

Description

NuGet.org requires uploading the public certificate (.cer) used for package signing. This cmdlet exports the selected certificate from the local certificate store.

Examples

Export by thumbprint

Export-CertificateForNuGet -CertificateThumbprint '0123456789ABCDEF' -OutputPath (Join-Path $env:TEMP 'NuGetSigning.cer')

Exports the certificate in DER format to the given path.

Export by SHA256 hash

Export-CertificateForNuGet -CertificateSha256 '0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF'

Useful when you have the SHA256 fingerprint but not the Windows thumbprint.

Parameters

-CertificateThumbprint String requiredsets: Thumbprint
The SHA1 thumbprint of the certificate to export.
-LocalStore CertificateStoreLocation optional
Certificate store location to use.
Possible values: CurrentUser, LocalMachine
-OutputPath String optional
Output path for the exported .cer file.
-CertificateSha256 String requiredsets: Sha256
The SHA256 hash of the certificate to export.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.