Skip to content

PowerShell PKI Module Documentation

Get-CertificateRequest

Synopsis

Retrieves an X.509 certificate signing request (CSR) object from a file or a DER-encoded byte array.

Syntax

Get-CertificateRequest [-Path] <String> [<CommonParameters>]

Get-CertificateRequest [-RawRequest] <Byte[]> [<CommonParameters>]

Description

Retrieves and decodes X.509 certificate request object from a file or a DER-encoded byte array.

Certificate signing request is a message sent from an applicant to a certificate authority in order to apply for a digital certificate. You can review formatted request information calling a "ToString()" method on returned object.

This command supports both, PKCS#10 and PKCS#7/CMC certificate reuqests.

Parameters

-Path <String>

Specifies the path to a certificate request file. Usually, this file has a ".req" or ".csr" file extension.

Required? True
Position? 0
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? False

-RawRequest <Byte[]>

Specifies a DER-encoded byte array that contains certificate request information.

Required? True
Position? 0
Default value
Accept pipeline input? false
Accept wildcard characters? False

<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, InformationAction, InformationVariable,
WarningAction, WarningVariable, OutBuffer, PipelineVariable and OutVariable.
For more information, see about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).

Inputs

System.String


System.Byte[]

Outputs

System.Security.Cryptography.X509CertificateRequests.X509CertificateRequest

Notes

Examples

Example 1

PS C:\> Get-CertificateRequest C:\mycert.req

Retrieves certificate request object from a file.

Example 2

PS C:\> $Raw = [convert]::FromBase64String($Base64encodedstring)
PS C:\> Get-CertificateRequest -RawRequest $Raw

In this example, $Base64encodedstring contains certificate request in a Base64 encoding and is converted to a byte array and passed to Get-CertificateRequest to get the request object.

Related links

Submit-CertificateRequest

Minimum PowerShell version support

  • PowerShell 3.0

Operating System Support

  • Windows 7
  • Windows 8
  • Windows 8.1
  • Windows 10
  • Windows Server 2008 R2 all editions
  • Windows Server 2012 all editions
  • Windows Server 2012 R2 all editions
  • Windows Server 2016 all editions
  • Windows Server 2019 all editions
Scroll To Top