How to import a pfx using certutil without prompt?

28,746

The reason you got a prompt dialog is that you are trying to add a "CA certificate" into the "Trusted Root Certification Authorities" store. In fact, when you use "certutil -f -user -p PASSWORD -importpfx c:\cert.pfx" to import a PFX certificate, two actions happen:

  1. Add a personal certificate(which includes the private key) into the "Personal" store.
  2. Add a CA certificate into the "Trusted Root Certification Authorities" store.

It is the second action that cause the UAC to prompt a warning dialog, since you are trying to add one CA certificate into the "Trusted Root Certification Authorities" store and this means that any web host that holds this certicate will be trusted in the future, this is a very important action and should be treated very discreetly by the user, shouldn't it? So the UAC will warn the user to comfirm this action.

There is only one way to suppress the warning dialog, that is "you don't add the CA certificate into the "Trusted Root Certification Authorities" store by doing so:

 certutil -f -user -p PASSWORD -importpfx c:\cert.pfx NoRoot

Add personal certificate into "Personal" store will not prompt any warning dialog. However, by this way, the web host that holds the CA certificate will not be trusted any more and this can be very frustrating if you use HTTPS to access the web host.

Share:
28,746
Amol Manthalkar
Author by

Amol Manthalkar

Updated on October 29, 2020

Comments

  • Amol Manthalkar
    Amol Manthalkar over 3 years

    I want to import a pfx using cmd. I am using certutils for that. But I am getting a prompt asking to trust the certificate. I want to automatize import so I want to skip the warning prompt. How can I accomplish that?

    Warning Prompt

    I am using command certutil -f -user -p PASSWORD -importpfx c:\cert.pfx