Re: Programmatically Install Certificate into Windows Certificate Store



Hi Brad..

Better late than never.

Is using the CLR 2.0 an option? It has a greatly expanded set of
classes for doing what you described below and is a lot easier than
using the Native Crypto API. Maybe I'm missing something, can't you
rely on HTTPS to automatically fetch the public part of the certificate
and automatically install it for you?

Kryz


Brad schreef:

I have a Personal Information Exchange PCKS #12 certificate file that
requires a password when manually installing. This certificate was
issued by a 3rd party company I need to communicate with via https.
Initially I exported the PCKS #12 certificate to DER encoded binary
X.509 certificate and used the following code to reference it in my
application:

// Create Certificate
X509Certificate cert = X509Certificate.CreateFromCertFile(strCertPath);

// Create request
HttpWebRequest req =
(HttpWebRequest)WebRequest.Create("https://serverurl/";);

// Add Certficate
req.ClientCertificates.Add(cert);

This works great as long as the original PCKS #12 cert is installed in
the Windows Certificate Store on the maching running the application.
Rather than having to go around to each client's computer and manually
installing this certificate on their machine so my application will
run, I would like to programmatically search the certificate store for
the PCKS #12 cert and, if it doesn't exist, install it on the fly.
Could anyone help me with this task? I've heard of CAPICOM, but most
of the references I've seen to it have either been relatively confusing
or not addressing the task at hand. Thanks in advance for any help.

.



Relevant Pages

  • Re: Certificate Services and Synching with Exchange
    ... Yes, installing the cert and self-signing worked, but only because ... Yes, I had to manually export and install it, but it was trivially ... You export the cert from the MMC to a .cer file. ... Will installing Certificate Services and self-signing a certificate ...
    (microsoft.public.pocketpc.activesync)
  • Re: Terminal Services over a VPN
    ... Create a certificate request and submit it to godaddy in order to obtain a public cert. ... You can use the wizard in IIS Manager for this by creating a new website that matches the above name (on your TS server), right-click and choose properties, directory security tab, server certificate button. ... After the install you can stop or delete the website created above since you don't need it for anything. ...
    (microsoft.public.windows.terminal_services)
  • Re: Web Certificate for IIS Server on SBS Domain
    ... and installed the free 30-day certificate on my site. ... instructions to install Certificate Services. ... If I can find a way to issue my own cert without risking my SBS setup, ... > Server instead of the defaults from Server 2003, and when things blow up, ...
    (microsoft.public.windows.server.sbs)
  • Re: Windows Update repeats
    ... You cannot install some updates or programs ... to a Windows component, install a service pack for Windows or for a Windows ... The Microsoft digital signature affirms that software has been tested with ... Publishers certificate store. ...
    (microsoft.public.windowsupdate)
  • Re: CertSrv Question
    ... In my case as posted earlier I didn't install a stand alone CA, ... In effect I want to revert everything on the domain to just before the root ... it replicated a certificate to the ... >>>The reason most likely is that the CA cert is still there in the NTAuth ...
    (microsoft.public.win2000.security)