I am trying to read the certificate stores of different servers.
I need to login to an admin user and access the server to read the certificate store. I cant find any other possibilities than the X509Store class to read a certificate store (https://learn.microsoft.com/de-de/dotnet/api/system.security.cryptography.x509certificates.x509store?view=netcore-3.1) but i cant figure out a possibility to login to a specific user with this class. I'm also not sure if it is possible to connect to a server with this class.
Maybe you can help me to solve my problem. Thank you
Unfortunately, you can't easily read other users certificate stores using X509Store. You have to setup impersonated logon session and run the code inside this session. See WindowsIdentity.Impersonate method for an example of how this can be achieved.