Sample code for 30+ languages & platforms
.NET Core C#

Find a Certificate in the "Other People" Windows Certificate Store

See more Certificates Examples

Demonstrates how to open the "Current User --> Other People" Windows certificate store, and locates a certificate matching an email address.

Chilkat .NET Core C# Downloads

.NET Core C#
bool success = false;

Chilkat.CertStore certStore = new Chilkat.CertStore();

// The "AddressBook" is the "Other People" certificate store as shown in certmgr.msc
bool readOnly = true;
success = certStore.OpenWindowsStore("CurrentUser","AddressBook",readOnly);
if (success != true) {
    Debug.WriteLine(certStore.LastErrorText);
    return;
}

// Find the certificate for the email address:
Chilkat.JsonObject jsonE = new Chilkat.JsonObject();
jsonE.UpdateString("email","joe@example.com");

Chilkat.Cert cert = new Chilkat.Cert();
success = certStore.FindCert(jsonE,cert);
if (success == false) {
    Debug.WriteLine(certStore.LastErrorText);
    return;
}

Debug.WriteLine("Found certificate: " + cert.SubjectDN);