Objective-C
Objective-C
Get Public Key from Certificate PEM
See more Certificates Examples
Loads a certificate from a PEM file and gets the cert's public key.Chilkat Objective-C Downloads
#import <CkoCert.h>
#import <CkoPublicKey.h>
BOOL success = NO;
CkoCert *cert = [[CkoCert alloc] init];
success = [cert LoadFromFile: @"qa_data/certs/someCert.pem"];
if (success == NO) {
NSLog(@"%@",cert.LastErrorText);
return;
}
// Get the certificate's public key:
CkoPublicKey *pubkey = [[CkoPublicKey alloc] init];
[cert GetPublicKey: pubkey];
NSLog(@"%@",[pubkey GetPem: NO]);
// OK.. we have the public key which can be used in other Chilkat classes/methods...