11

We can use the X509store to load the store and find the certificates in local machine but how to do the same for a certificate sitting on remote server?

I know we can configure a network account to have permissions on the certificate in remote machine but how to use this network account to read certificate details?

X509Store store = new X509Store(StoreName.My, StoreLocation.LocalMachine);
store.Open(OpenFlags.ReadOnly);
X509Certificate2Collection results = store.Certificates.Find(X509FindType.FindBySubjectName, "CertName", false);
John Saunders
  • 160,644
  • 26
  • 247
  • 397
Rakesh Vasu
  • 155
  • 1
  • 8

1 Answers1

12

You can use this X509Store overload: https://msdn.microsoft.com/en-us/library/f07btzah(v=vs.110).aspx

where you can specify remote server path: \\RemoteServerName\My in the storeName parameter.

Crypt32
  • 12,850
  • 2
  • 41
  • 70
  • I have been parked in the same page from morning but I didnot know that we could refer to remote server like \\[Machine]\StoreName. Thank you – Rakesh Vasu Jun 19 '15 at 20:25
  • Can we also specify different domain in front of remote server name? – Rakesh Vasu Jun 19 '15 at 20:57
  • yes, you can specify FQDN of the remote server. But make sure if authentication and permissions are configured properly between domains. – Crypt32 Jun 20 '15 at 03:50
  • 1
    Hi @CryptoGuy , i tried to give machine name/remote server name which is my colleague machine but i didn't succeed. I've given name in such format \\Machinename\My , If i try to access the same machine using run command than it works fine for me . i am using C# code base Please advise – Sachin Kalia Sep 16 '15 at 13:50
  • But this doesn't work for "CurrentUser". Any hints how to get it?? – Koder101 May 12 '18 at 21:18
  • No, this doesn't work for remote users for security reasons. – Crypt32 May 13 '18 at 06:33