Hy,
I have the following application:
- server application that uses a digital certificate to login to a website; first time i run the app it requires the pin number from the token... certificate is stored on token); i use X509CertificateUI to select the certificate and it pops-up the token client to enter pin number;
- client application connects to my server app and send some data which the server passes to the website to get response and send back to the client.
Everything is working ok. BUT... i want to make it a windows service. (currently is form based). I have done the service part, i installed it, can start it from the service manager, but it doesn't show the certificate selection and the token client for the pin.
here is the server code to get the certificate;
var store = new X509Store("MY", StoreLocation.CurrentUser);
store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly);
X509Certificate2Collection selection = X509Certificate2UI.SelectFromCollection(store.Certificates,
"Digital Certificates",
"Select a certificate from the following list:",
X509SelectionFlag.
SingleSelection);
After i select it and enter the token pin number it works ok, but haven't been able to do the same as a windows service. I have also exported the certificate into a file from the token and declared a x509cert from local file but it should also require the token pin number.
X509Certificate2 localCert = new X509Certificate2(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\my.cer");
return localCert;
thanks