< Back

ConvertFrom-RSAPrivateKeyPEM

Sat Jan 11, 2020 12:43 pm

NAME ConvertFrom-RSAPrivateKeyPEM



SYNOPSIS

Converts a PKCS#1 format PEM file to an RSACryptoServiceProvider object.





SYNTAX

ConvertFrom-RSAPrivateKeyPEM [-PEM] <String> [<CommonParameters>]



ConvertFrom-RSAPrivateKeyPEM -Path <String> [<CommonParameters>]





DESCRIPTION

This cmdlet takes a PKCS#1 formatted RSA private key and converts it to

an RSACryptoServiceProvider object.





PARAMETERS

-PEM <String>

The PEM content of the RSA Private Key. This can either be the complete PEM file contents

or just the base64 encoded data.



Required? true

Position? 1

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Path <String>

The path to a properly encoded PEM file with the appropriate Header and Footer text.



The file can only contain a single key, subsequent keys in the same file will be ignored.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

System.String





OUTPUTS

System.Security.Cryptography.RSACryptoServiceProvider





NOTES





AUTHOR: Michael Haken

LAST UPDATE: 1/26/2018



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>$Key = @"



-----BEGIN RSA PRIVATE KEY-----

<base64encodedkeydata>

-----END RSA PRIVATE KEY-----

"@



$RSA = ConvertFrom-RSAPrivateKeyPEM -PEM $Key



This will convert the PEM file containing a private key to an RSACryptoServiceProvider object.











RELATED LINKS