CERTUTIL doesn't seem to handle double-quotes in a password

Graeme Williams 0 Reputation points
2023-03-02T13:24:14.0633333+00:00

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?

Windows
Windows
A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.
5,099 questions
Sysinternals
Sysinternals
Advanced system utilities to manage, troubleshoot, and diagnose Windows and Linux systems and applications.
1,132 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 44,121 Reputation points
    2023-03-03T16:38:17.86+00:00

    Hi. Thank you for your question and reaching out. I’d be more than happy to help you with your query.

    I am so sorry about that. The solution for this that I have experienced before is try to double quote the password and also, please be sure when it comes to completing the password, it should be enclosed in quotes. And I am also sorry to inform you that CERTUTIL is not handling a double quotes in the password that is why you're having an issue with this.

    If the reply was helpful, please don’t forget to upvote or accept as answer, thank you.

    0 comments No comments