PSPKI icon indicating copy to clipboard operation
PSPKI copied to clipboard

Get-CertificationAuthority / not supported path

Open ivoruetsche opened this issue 3 years ago • 3 comments

Hi I have something similar to https://github.com/PKISolutions/PSPKI/issues/111:

With Get-CertificationAuthority, I got a "The given path's format is not supported." Error (UNC Path):

PS C:\windows\system32> Import-module -Name PSPKI -Prefix PSPKI
PS C:\windows\system32> $oCertAuth = Get-PSPKICertificationAuthority -Name "Test-Casandra-Issuing-CA-00"
PS C:\windows\system32> $oSubReqRes = Submit-PSPKICertificateRequest -Path "\\filer-00\pki00$\csr\Casandra_AAF\MyDevice3-pem_req__Test-Casandra-Issuing-CA-00" -CertificationAuthority $oCertAuth -Attribute Certificate
Template:Casandra_AAF_2
Exception calling "ReadAllText" with "1" argument(s): "The given path's format is not supported."
At C:\Program Files\WindowsPowerShell\Modules\PSPKI\3.7.2\Client\Submit-CertificateRequest.ps1:70 char:5
+ ...             $Request = [IO.File]::ReadAllText((Resolve-Path $_).Path) ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : NotSupportedException

Okay, so I try only this part where the error referenced:

PS C:\windows\system32> [IO.File]::ReadAllText((Resolve-Path "\\filer-00\pki00$\csr\Casandra_AAF\MyDevice3-pem_req__Test-Casandra-Issuing-CA-00").Path)
Exception calling "ReadAllText" with "1" argument(s): "The given path's format is not supported."
At line:1 char:1
+ [IO.File]::ReadAllText((Resolve-Path "\\filer-00\pki00$\csr\Ca ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : NotSupportedException

Some more tries in the deep:

PS C:\windows\system32> (Resolve-Path "\\filer-00\pki00$\csr\Casandra_AAF\MyDevice3-pem_req__Test-Casandra-Issuing-CA-00").Path
Microsoft.PowerShell.Core\FileSystem::\\filer-00\pki00$\csr\Casandra_AAF\MyDevice3-pem_req__Test-Casandra-Issuing-CA-00
PS C:\windows\system32> (Resolve-Path "\\filer-00\pki00$\csr\Casandra_AAF\MyDevice3-pem_req__Test-Casandra-Issuing-CA-00").ProviderPath
\\filer-00\pki00$\csr\Casandra_AAF\MyDevice3-pem_req__Test-Casandra-Issuing-CA-00
PS C:\windows\system32> [IO.File]::ReadAllText((Resolve-Path "\\filer-00\pki00$\csr\Casandra_AAF\MyDevice3-pem_req__Test-Casandra-Issuing-CA-00").ProviderPath)
-----BEGIN CERTIFICATE REQUEST-----
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-----END CERTIFICATE REQUEST-----

PS C:\windows\system32> (Resolve-Path "\\filer-00\pki00$\csr\Casandra_AAF\MyDevice3-pem_req__Test-Casandra-Issuing-CA-00")|select *

Drive Provider                             ProviderPath                                                                                   Path
----- --------                             ------------                                                                                   ----
      Microsoft.PowerShell.Core\FileSystem \\filer-00\pki00$\csr\Casandra_AAF\MyDevice3-pem_req__Test-Casandra-Issuing-CA-00 Microsoft.PowerShell.Core\FileSystem::\\filer-00\pki00$\csr\Casandra_AAF\MyDevice3-pem_req__Test-Casandra-Issuing-CA-00


PS C:\windows\system32> Get-Host | Select-Object Version

Version
-------
5.1.14393.3053


PS C:\windows\system32>

I think, should be solvable?

gruss ivo

ivoruetsche avatar Sep 10 '20 11:09 ivoruetsche

You can fix it yourself until next version. Update this line in Submit-CertificateRequest file:

$Request = [IO.File]::ReadAllText((Resolve-Path $_).Path)

to this:

$Request = [IO.File]::ReadAllText((Resolve-Path $_).ProviderPath)

Crypt32 avatar Sep 10 '20 12:09 Crypt32

Yes, that's what I did :-)

ivoruetsche avatar Sep 10 '20 14:09 ivoruetsche

A fix is added.

Crypt32 avatar Nov 06 '20 06:11 Crypt32

Fixed in v4.0.0

Crypt32 avatar Jun 15 '23 07:06 Crypt32