< Back
ConvertFrom-RSAPublicKeyPEM
Post
NAME ConvertFrom-RSAPublicKeyPEM
SYNOPSIS
Converts a PKCS#1 format PEM file to an RSACryptoServiceProvider object.
SYNTAX
ConvertFrom-RSAPublicKeyPEM [-PEM] <String> [<CommonParameters>]
ConvertFrom-RSAPublicKeyPEM -Path <String> [<CommonParameters>]
DESCRIPTION
This cmdlet takes a PKCS#1 formatted RSA public 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 PUBLIC KEY-----
<base64encodedkeydata>
-----END RSA PUBLIC KEY-----
"@
$RSA = ConvertFrom-RSAPublicKeyPEM -PEM $Key
This will convert the PEM file containing a public key to an RSACryptoServiceProvider object.
RELATED LINKS
SYNOPSIS
Converts a PKCS#1 format PEM file to an RSACryptoServiceProvider object.
SYNTAX
ConvertFrom-RSAPublicKeyPEM [-PEM] <String> [<CommonParameters>]
ConvertFrom-RSAPublicKeyPEM -Path <String> [<CommonParameters>]
DESCRIPTION
This cmdlet takes a PKCS#1 formatted RSA public 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 PUBLIC KEY-----
<base64encodedkeydata>
-----END RSA PUBLIC KEY-----
"@
$RSA = ConvertFrom-RSAPublicKeyPEM -PEM $Key
This will convert the PEM file containing a public key to an RSACryptoServiceProvider object.
RELATED LINKS