2

I'm using without any error A1 certificates (digital certificate) with in a Service.

A3 certificates (SmartCard) needs a PIN to start working. The problem is that the Service won't show any window to input the PIN.

Is there a way to make the service show the PIN window?

4
  • Services aren't really allowed to interact with the UI. stackoverflow.com/questions/12953148/…
    – Bob G
    Jun 15, 2015 at 18:14
  • Even if the PIN pop up isn't mine? The SmartCard manager should display that. Jun 15, 2015 at 18:21
  • No it shouldn't. Everything since Vista has been this way.
    – Bob G
    Jun 15, 2015 at 18:40
  • 1
    Even if the app you're launching from your service, or invoking, or whatever isn't yours, it has no bearing on it showing. Lookup Session 0 Isolation. Some more links: programmers.stackexchange.com/questions/180833/…
    – Bob G
    Jun 15, 2015 at 18:47

1 Answer 1

1

I guess your service is using Microsoft CryptoAPI to interact with the smartcard. While this is the easiest approach in most cases it does not give you full control over the smartcard/application behavior i.e. you cannot control when is the PIN dialog shown, you cannot customize PIN dialog etc.

You can try this approach:

  1. Make sure that windows service called "Interactive Services Detection" is started and running on your system.
  2. Change the properties of your windows service (right click it in the list of services and select "Properties" menu item) and check the "Allow service to interact with desktop" option on "Log On" tab.
  3. Start your service and your desktop should be switched to session0 where the PIN dialog will be shown.

If the above does not work and you can modify the source code of you service then you can try to use PKCS#11 API instead of MS CryptoAPI. PKCS#11 API gives you much more control over your smartcard/application behavior and it can be used conveniently and quickly in .NET applications with Pkcs11Interop library which I am the author of.

3
  • I don't need to customize the PIN dialog. I just need to show that dialog when trying to use the certificate. I'm simply searching the certificate store and opening as a X509 object. Jun 16, 2015 at 14:21
  • @NickeManarin Did you try to enable desktop interaction suggested in my answer?
    – jariq
    Jun 17, 2015 at 8:40
  • I didn't try. The services needs to access cliente certificates, so it must run under a specific account. The only way to check ...Interact with desktop is checking Local System Account. Jun 17, 2015 at 12:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.