Home All Groups Group Topic Archive Search About

Set private key programmaticaly without using CAPICOM and CryptSetProvParam method

Author
28 Apr 2005 1:14 PM
Maccari Claudio
I wrote down this little piece of code:

CertificateManager cm = new CertificateManager();
X509Certificate2 c = cm.GetCertificate(userName); //get certificate  from
the store using  X509Store class
_ws.ClientCertificates.Add(c);
_ws.SessionInfoValue = new SessionInfo();
_ws.SessionInfoValue.SessionId = String.Empty;
_ws.Login(String.Empty, String.Empty)

when I use a digital certificate whose private key is hardware-protected,
during the call of a method of the Web Service, start SSL handshake, the
certificate is included in it and the user is asked to submit PIN (with a
Windows Dialog) to access private key.
It there a way to set private key programmaticaly without using CAPICOM and
CryptSetProvParam method so the user does not need to enter PIN code.

Thank you for help.
Claudio