Import Certificate to Trusted Root but not to Personal [Command Line]

前端 未结 5 1947
时光说笑
时光说笑 2021-01-31 17:14

I am trying to import two certificates to my local machine using the command line.

I have one certificate to add to the Personal Store of the local machine, and another

相关标签:
5条回答
  • 2021-01-31 17:53

    To print the content of Root store:

    certutil -store Root
    

    To output content to a file:

    certutil -store Root > root_content.txt
    

    To add certificate to Root store:

    certutil -addstore -enterprise Root file.cer
    
    0 讨论(0)
  • 2021-01-31 18:00

    Look at the documentation of certutil.exe and -addstore option.

    I tried

    certutil -addstore "Root" "c:\cacert.cer"
    

    and it worked well (meaning The certificate landed in Trusted Root of LocalMachine store).

    EDIT:

    If there are multiple certificates in a pfx file (key + corresponding certificate and a CA certificate) then this command worked well for me:

    certutil -importpfx c:\somepfx.pfx
    

    EDIT2:

    To import CA certificate to Intermediate Certification Authorities store run following command

    certutil -addstore "CA" "c:\intermediate_cacert.cer"
    
    0 讨论(0)
  • 2021-01-31 18:01

    The below 'd help you to add the cert to the Root Store-

    certutil -enterprise -f -v -AddStore "Root" <Cert File path>
    

    This worked for me perfectly.

    0 讨论(0)
  • 2021-01-31 18:01

    There is a fairly simple answer with powershell.

    Import-PfxCertificate -Password $secure_pw  -CertStoreLocation Cert:\LocalMachine\Root -FilePath certs.pfx
    

    The trick is making a "secure" password...

    $plaintext_pw = 'PASSWORD';
    $secure_pw = ConvertTo-SecureString $plaintext_pw -AsPlainText -Force; 
    Import-PfxCertificate -Password $secure_pw  -CertStoreLocation Cert:\LocalMachine\Root -FilePath certs.pfx;
    
    0 讨论(0)
  • 2021-01-31 18:03

    If there are multiple certificates in a pfx file (key + corresponding certificate and a CA certificate) then this command worked well for me:

    certutil -importpfx c:\somepfx.pfx this works but still a password is needed to be typed in manually for private key. Including -p and "password" cause error too many arguments for certutil on XP

    0 讨论(0)
提交回复
热议问题