Search code examples
delphiservicecertificateusbtoken

Can't read a usb token (certificate) when the application is called by a service


I have two systems, one is an ERP and the other is a POS application, and i have a customer which uses an usb token to assign some files. I have two scenarios:

  1. When i use the ERP to assign a file, he calls a application which is made just for do it, its called DFe and it works well, he finds the certificate.
  2. In my POS, to do the same operation, it calls general service application who menages all our system, and this service call DFe, but when DFe is called from my general service, it doesn't find mine certificate, Windows returns the error "key set is not defined". I already did my service logon with user's credentials, but it didn't worked

Why my application doesn't find the certificate in this second scenario?

PS: The system is Windows 7


Solution

  • I solved the problem moving the certificate from local user to computer local on mmc.exe, I set the service to run on local computer and it works