Error : "Impossible to find object or property", when loading a private certificate in a Windows service running as LocalSystem. RRS feed

  • Question

  • Hi

    I am developing a Windows service middleware that uses security certificates to perform authentication when it wants to initialize a secure communication channel with remote applications.

    The Windows service is a .Net 3.5  application that uses (via a C++/CLI layer) the C++ WinCrypt library in order to load certificates. In particular I am calling the CertFindCertificateInStore method when i accessing the store to load the certificate. The CertFindCertificateInStore uses the “My” system store as store by default.

    I have registered my private certificate in the “My” system store either for the current user (the user logged onto the machine) either for the local machine, via the MMC console. Be sure that the certificate is good and it includes my private key.

    When i run the Windows service as current user (again the user logged onto the machine)  the certificate is correctly loaded,  instead the certificate is not loaded when i run the service as “LocalSystem”. The error  "Impossible to find object or property", is then raised when I call the CertFindCertificateInStore. I point up that the “My” store instead continues to be accessible.

    (NB: When I open a new session using a different user and I run the same Windows service as user for whom I registered the certificates, the certificate is again correctly loaded)

    Then I used either the MMC console either the winhttpcertcfg.exe system tool in order to verify that the “LocalSystem” user has the rights to access my certificate. Afterwards either the MMC console and the winhttpcertcfg.exe tool confirm that THEORETICALLY the user “LocalSystem” has the rights to access the certificate.

    Do you have any suggestion to help me to solve this problem?

    Thank you in advance for your help,

    Wednesday, November 7, 2012 12:06 PM