Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert-PfxToPem returns "Invalid provider type specified" when converting PFX to PEM. #154

Open
richardhicks opened this issue Jun 22, 2021 · 4 comments

Comments

@richardhicks
Copy link

When using Convert-PfxToPem in PSPKI v3.7.2 I am receiving an error stating "Invalid provider type specified". Below is the exact command syntax and output.

$Pwd = ConvertTo-SecureString -String 'foobar' -AsPlainText -Force
Convert-PfxToPem -InputFile C:\foo.pfx -Password $pwd -OutputFile C:\foo.pem -OutputType Pkcs1 -Verbose

Invalid provider type specified
At C:\Program Files\WindowsPowerShell\Modules\pspki\3.7.2\Client\Convert-PfxToPem.ps1:141 char:3

  •     throw New-Object ComponentModel.Win32Exception ([Runtime.Inte ...
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : OperationStopped: (:) [], Win32Exception
    • FullyQualifiedErrorId : Invalid provider type specified
@Crypt32
Copy link
Collaborator

Crypt32 commented Jun 25, 2021

This is a known issue when private key is stored in KSP. There is an issue with the way how .NET imports the PFX and making it exportable — it is exportable, but only in encrypted form (PFX) and doesn't allow key export in raw PKCS1/PKCS8 format.

@richardhicks
Copy link
Author

Got it. Thanks for the information, Vadims.

@Crypt32 Crypt32 reopened this Jun 25, 2021
@Crypt32
Copy link
Collaborator

Crypt32 commented Jun 25, 2021

Reopening this. There is a chance to get this working for certificates installed in store, rather than PFX.

@richardhicks
Copy link
Author

Ok, thanks!

Crypt32 added a commit that referenced this issue Jul 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants