Add a self-signed certificate to the trusted root certificate store using the command line


Johnny Depp

Is there any way to add a certificate to the local computer's Trusted Root Certification Authorities using the command line? I tried using certmgr.exe and it shows success, but when I check the root CA, I don't see my certificate there.

I followed the guide here:

http://msdn.microsoft.com/en-us/library/ms172241.aspx

Basically try this command:

certmgr.exe -add -c mycertificate.cer -s -r localMachine root

The command works and shows success on the command line, but I can't see the certificate in the actual trusted root store via mmc, is the process different for self-signed certificates? I have setup an IIS server with SSL bound to this certificate, which is initially in the "MY" store. But im doing everything through an automated script, so i want to know how to add this certificate to the trusted root CAs using the cmd line option?

cheat

Have you tried it manually (by double clicking on the CER file)? Even doing it manually doesn't work and you may run into Vista errors .

Install the root CA certificate from the command line (cmd.exe)

(This requires the Windows SDK. VisualStudio will install it for you and add it to it %PATH%.)

certmgr /add /c mycertificate.cer /s /r localMachine root

Note that no errors will be reported; the command will always return success (even with a non-existing certificate file!). If the certificate does not appear in the Certificate Manager ( ) certmgr.mscafter running this command, repeat the process using the following manual steps to check for any errors in the certificate file.

Manual steps to install the root CA certificate

  1. Double-click the .cerfile.
  2. In the Certificate dialog box, click Install Certificate to start the Certificate Import Wizard .
  3. On the Welcome page, click Next .
  4. On the Certificate Store page, select Place all certificates in the following store , and then click Browse .
  5. In the Select Certificate Store dialog box, select Show Physical Store .
  6. Double-click Trusted Root Certification Authorities , select Local Computer , and then click OK .
  7. On the Certificate Store page, click Next .
  8. On the summary page, review the details and click Finish .

Install the root CA certificate from PowerShell

See @harrymc's great answer below.

Related


Add self-signed certificate to "Trusted List"

Naftuli Kay I've generated a self-signed certificate for my build server and I want to trust that certificate globally on my machine because I create the keys myself and I hate seeing warnings. I am on Ubuntu 12.04. How can I put the certificate and trust it g

Add self-signed certificate to "Trusted List"

Naftuli Kay I've generated a self-signed certificate for my build server and I want to trust that certificate globally on my machine because I create the keys myself and I hate seeing warnings. I am on Ubuntu 12.04. How can I put the certificate and trust it g

Add self-signed certificate to "Trusted List"

Naftuli Kay I've generated a self-signed certificate for my build server and I want to trust that certificate globally on my machine because I create the keys myself and I hate seeing warnings. I am on Ubuntu 12.04. How can I put the certificate and trust it g

Add self-signed certificate to "Trusted List"

Naftuli Kay I've generated a self-signed certificate for my build server and I want to trust that certificate globally on my machine because I create the keys myself and I hate seeing warnings. I am on Ubuntu 12.04. How can I put the certificate and trust it g

Install Self Signed Certificate as Trusted Root on Windows XP

jospe I have successfully installed a self signed certificate to Windows7. The process is to install it to the Trusted Root Certification Authorities (the local computer) first, and then install it to the trusted people (the local computer). (Without installin

Install Self Signed Certificate as Trusted Root on Windows XP

jospe I have successfully installed a self signed certificate to Windows7. The process is to install it to the Trusted Root Certification Authorities (the local computer) first, and then install it to the trusted people (the local computer). (Without installin

Keytool Create Trusted Self-Signed Certificate

sixtyfootersdude: I'm trying to create a self-signed certificate using (java) keytool, but when I try to use it, I get the following exception (see bottom for full exception). ...<5 more exceptions above this> Caused by: sun.security.validator.ValidatorExcepti

Keytool Create Trusted Self-Signed Certificate

sixtyfootersdude: I'm trying to create a self-signed certificate using (java) keytool, but when I try to use it, I get the following exception (see bottom for full exception). ...<5 more exceptions above this> Caused by: sun.security.validator.ValidatorExcepti

Trusted CA on self-signed certificate

horny I have an old Linux based embedded device from a project about ten years ago. The device has no built-in UI, keyboard or anything like that, just a small web server to control it. I have since forgotten the passcode on the device and the company that ori

Keytool Create Trusted Self-Signed Certificate

sixtyfootersdude: I'm trying to create a self-signed certificate using (java) keytool, but when I try to use it, I get the following exception (see bottom for full exception). ...<5 more exceptions above this> Caused by: sun.security.validator.ValidatorExcepti

Trusted CA on self-signed certificate

horny I have an old Linux based embedded device from a project about ten years ago. The device has no built-in UI, keyboard or anything like that, just a small web server to control it. I have since forgotten the passcode on the device and the company that ori

Add self-signed root certificate to Azure App Service

Alex Meyer I have an Azure based .NET web application that we are trying to connect to a client's local ADFS environment. We are able to access the resources through the Azure Hybrid connection, but when we try to get the authentication headers from ADFS, we g

Add self-signed root certificate to Azure App Service

Alex Meyer I have an Azure based .NET web application that we are trying to connect to a client's local ADFS environment. We are able to access the resources through the Azure Hybrid connection, but when we try to get the authentication headers from ADFS, we g

Add self-signed root certificate to Azure App Service

Alex Meyer I have an Azure based .NET web application that we are trying to connect to a client's local ADFS environment. We are able to access the resource through the Azure Hybrid connection, but when we try to get the authentication headers from ADFS, we ge

Add self-signed root certificate to Azure App Service

Alex Meyer I have an Azure based .NET web application that we are trying to connect to a client's local ADFS environment. We are able to access the resource through the Azure Hybrid connection, but when we try to get the authentication headers from ADFS, we ge