(Objective-C) Find a Certificate in the "Other People" Windows Certificate Store
Demonstrates how to open the "Current User --> Other People" Windows certificate store, and locates a certificate matching an email address.
#import <CkoCertStore.h>
#import <CkoCert.h>
CkoCertStore *certStore = [[CkoCertStore alloc] init];
// The "AddressBook" is the "Other People" certificate store as shown in certmgr.msc
BOOL readOnly = YES;
BOOL success = [certStore OpenWindowsStore: @"CurrentUser" storeName: @"AddressBook" readOnly: readOnly];
if (success != YES) {
NSLog(@"%@",certStore.LastErrorText);
return;
}
CkoCert *cert = 0;
cert = [certStore FindCertByRfc822Name: @"sales.edifact@somewhere.com"];
if (certStore.LastMethodSuccess != YES) {
NSLog(@"%@",certStore.LastErrorText);
return;
}
NSLog(@"%@%@",@"Found certificate: ",cert.SubjectDN);
|