How can I silently install root certificates from WiX? I'm installing some root and intermediate certificates, and for root certificates the system displays confirmation dialog showing basic certificate properties and thumbprint. This is relevant code I have, using WixIIsExtension
mapped in namespace iis
:
<Binary Id="RootCa" SourceFile="Certificates\RootCa.cer" />
<DirectoryRef Id="TARGETDIR">
<Component Id="RootCa" Guid="...">
<iis:Certificate
Id="RootCa"
BinaryKey="RootCa"
Name="RootCa"
StoreLocation="currentUser"
StoreName="root"/>
</Component>
</DirectoryRef>
<Feature ...>
<ComponentRef Id="RootCa" />
</Feature>
Custom action that Sunil provided is equivalent to
Certificate
component with attributeStoreLocation="localMachine"
. In my case installing in machine store makes more sense anyway, so I'll go with that. Original question still remains: how to silently install root certificate in user store. If someone has an answer to that question I'll mark it as correct answer.I am using custom action for same
I`ve been looking for an answer long time ago. So, thats what I have:
WiX Code:
C++ Code:
Hope will help u
I have had issues with installing certificates with WiX - two problems I got:
1. If you tell WiX to install in the trusted root certificates on the local machine, it does not work, installs in the Personal Store instead.
2. Permissions for certificates installed by WiX (when they have a private key) do not have the Everyone user set up. [You can change the permissions using MMC->Certificate Manager->Local Machine->(locate certificate with private key) Right Click->All Tasks->Manage Private key, which brings up a file permission dialog].
You can avoid both of these problems by using the microsoft winhttpcertcfg.exe tool. I use it in a batch file (see below), and use a WiX silent custom action to call the batch file. I let WiX install the tool, the certificates and the batch files before executing the batch. The batch can be setup to delete the tool and certificates after installation. It can also be used to start a service that WiX installed that depends on the certificates. The use of the batch greatly reduces the number of custom actions in your WiX file.
The consequence of not installing the certificates correctly was an intermittent error (some machines worked, some not) with a .net client "Could not create SSL/TLS secure channel" exception when doing an http request.
I install the batch install and uninstall file in the product. Then in WiX - note the deferred and impersonated custom action.