I'm having an issue with CERTUTIL. I can't find a way to escape the double-quote character. I have a PFX file with the password 'Pass"word' (no single-quotes.) The following command produces this output:
C:\Logs>CERTUTIL -f -p Pass"word -importpfx 1.pfx
Entry 0:
[edited]
Entry 1:
[edited]
CertUtil: -dump command completed successfully.
It looks like if CERTUTIL cannot parse the command line it just does a dump.
Everything I do to escape the quotes produces this output, apart from using double double-quotes, as in:
C:\Logs>CERTUTIL -f -p Pass""word -importpfx 1.pfx
CertUtil: -importPFX command FAILED: 0x80070056 (WIN32: 86
ERROR_INVALID_PASSWORD)
CertUtil: The specified network password is not correct.
Now it says the password is incorrect when it should be correct. I have tried using single-quotes and double-quotes around the password, to no avail (double-quotes allow spaces to be recognized in passwords.)
I have used API Monitor to see what's going on. That shows this:
# Time of Day Thread Module API Return Value Error Duration
2604 8:53:50.781 AM 1 certutil.exe DispatchMessageW ( 0x00000062e2ebfb50 )
2605 8:53:50.781 AM 1 certutil.exe LocalAlloc ( LMEM_FIXED, 68 )
2606 8:53:50.781 AM 1 KERNELBASE.dll RtlAllocateHeap ( 0x0000020f00ec0000, HEAP_CREATE_ENABLE_EXECUTE | 1048576, 68 )
2607 8:53:50.781 AM 1 certutil.exe wcschr ( "CertUtil", ' ' )
2608 8:53:50.781 AM 1 certutil.exe wcschr ( "-f", ' ' )
2609 8:53:50.781 AM 1 certutil.exe wcschr ( "-p", ' ' )
**2610 8:53:50.781 AM 1 certutil.exe wcschr ( "Password", ' ' )**
2611 8:53:50.781 AM 1 certutil.exe wcschr ( "-importpfx", ' ' )
2612 8:53:50.781 AM 1 certutil.exe wcschr ( "1.pfx", ' ' )
As you can see, the quotes have been removed, which is why it's not working.
So, my question is, how can I get CERTUTIL to work with quotes in the password?