Access to local machine store

Access to local machine store

Secure Home | Search | About
 Microsoft Applications Security    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content add this group's latest topics to your Google content
Subject Author Date
Access to local machine store Niels Thrane 06-02-2008
Posted by Niels Thrane on June 2, 2008, 4:08 am
If you were  Registered and logged in, you could reply and use other advanced thread options
Hi,

I have payment system where my web server receives credit card numbers
securely (via HTTPS) from customers. In order to settle the amount that
the customer owes I have to make an SSL connection to a payment gateway.
That second SSL connection needs to be two-way authenticated (the remote
server needs to know my identity).

I'm using the following C# code to do that:

X509Store store = new X509Store(StoreLocation.LocalMachine);
store.Open(OpenFlags.OpenExistingOnly);
X509Certificate2Collection validCerts =
store.Certificates.Find(X509FindType.FindBySubjectName, "mycertname", true);
//ssl is my SslStream object
ssl.AuthenticateAsClient("server-cert-name", validCerts,
System.Security.Authentication.SslProtocols.Ssl3, true);

This seems to work just fine when I test it under my (admin) account.
However, it doesn't work when I run the code under IIS. The error I'm
getting is "The credentials supplied to the package were not
recognized". I guess the reason is that one needs admin rights to access
the local machine store where my SSL certificate is stored. I don't want
to run IIS under an admin account so the best solution would probably be
to allow the "Network Service" account access to the certificate.

I have found two ways of doing that: I can use the winhttpcertcfg tool
OR I can find the certificate file in the file system and grant read
access to "network service". I can't install winhttpcertcfg on the
system for regulatory reasons and messing with the (undocumented?) file
structure seems like a major hack.


In short, what is the best way of allowing my code to authenticate
itself as coming from my machine while running under the "network
service" account ?

Best regards,

Niels

Similar ThreadsPosted
how to success OpenScManager for local machine when logged in with a user don't have administrator privileges May 7, 2008, 4:34 am
VPN Client and Machine Certificates for Unattanded VPN access September 11, 2007, 11:28 am
Local Admin access through Active Directory April 6, 2006, 7:43 pm
Local System Account & Network Access June 29, 2006, 9:08 am
CA store July 6, 2006, 4:22 pm
Certificate store question February 4, 2008, 1:01 pm
Store private key in assembly May 6, 2008, 5:56 am
Is there a way to get certificate store path from CERT_CONTEXT March 6, 2006, 11:07 am
Find all members of local groups (Local Administrators in all doma June 6, 2007, 5:55 pm
how to check .pfx certificates in personal store remotely April 5, 2006, 11:50 am

The site map in XML format XML site map

Contact Us | Privacy Policy