Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / July 2006

Tip: Looking for answers? Try searching our database.

Programmatically Install Certificate into Windows Certificate Store

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Brad - 26 Jun 2006 20:08 GMT
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 a 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.
Michael D. Ober - 02 Jul 2006 00:17 GMT
Are you in a domain?  If so, you can install via GPO.

Mike Ober.

> I have a Personal Information Exchange PCKS #12 certificate file that
> requires a password when manually installing.  This certificate was
[quoted text clipped - 23 lines]
>
> or not addressing the task at hand.  Thanks in advance for any help.
Brad - 31 Jul 2006 21:32 GMT
Mike,

Thanks for the response.  I was able to get everything to work for a
Windows form application, but now it's been moved to an N-tier system
and it no longer works.  Now I get a 403 Forbidden error using
identical code.  I'm not sure if the problem is that the ASP.NET user
doesn't have access to the cert or what.  I know it has access to the
.cer file that I exported from the .p12 file.  I also know the original
P12 certificate has been installed on the machine the business layer
runs on.  I get the same 403 error when I attempt to debug the app with
everything running on my local machine.  I've installed the
certificates to the Personal and Trust Root stores for the "ASP.NET
State Service" as well as for the "Local Machine" via the MMC.  Any
ideas what's up?

> Are you in a domain?  If so, you can install via GPO.
>
[quoted text clipped - 27 lines]
> >
> > or not addressing the task at hand.  Thanks in advance for any help.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.