Objective-C
Objective-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 Objective-C Downloads
#import <CkoCertStore.h>
#import <CkoJsonObject.h>
#import <CkoCert.h>
BOOL success = NO;
CkoCertStore *certStore = [[CkoCertStore alloc] init];
// The "AddressBook" is the "Other People" certificate store as shown in certmgr.msc
BOOL readOnly = YES;
success = [certStore OpenWindowsStore: @"CurrentUser" storeName: @"AddressBook" readOnly: readOnly];
if (success != YES) {
NSLog(@"%@",certStore.LastErrorText);
return;
}
// Find the certificate for the email address:
CkoJsonObject *jsonE = [[CkoJsonObject alloc] init];
[jsonE UpdateString: @"email" value: @"joe@example.com"];
CkoCert *cert = [[CkoCert alloc] init];
success = [certStore FindCert: jsonE cert: cert];
if (success == NO) {
NSLog(@"%@",certStore.LastErrorText);
return;
}
NSLog(@"%@%@",@"Found certificate: ",cert.SubjectDN);