Sample code for 30+ languages & platforms
Objective-C

Get Issuer Certificate Information

See more Certificates Examples

A certificate contains information about its issuer. This example demonstrates how to get the issuer information from a certificate.

Chilkat Objective-C Downloads

Objective-C
#import <CkoCert.h>

BOOL success = NO;

CkoCert *cert = [[CkoCert alloc] init];

success = [cert LoadFromFile: @"qa_data/certs/sample.cer"];
if (success == NO) {
    NSLog(@"%@",cert.LastErrorText);
    return;
}

// Get issuer information:

// -----------------------------------------------------------------------
// (Not all subject fields may exist depending on the issuer certificate.)
// -----------------------------------------------------------------------

// Issuer DN (Distinguished Name, i.e. all the Issuer subject parts)
NSLog(@"%@%@",@"DN: ",cert.IssuerDN);

// Common Subject parts:
// Issuer Common Name
NSLog(@"%@%@",@"CN: ",cert.IssuerCN);

// Issuer Country
NSLog(@"%@%@",@"C: ",cert.IssuerC);

// Issuer Email address
NSLog(@"%@%@",@"E: ",cert.IssuerE);

// Issuer Locality
NSLog(@"%@%@",@"L: ",cert.IssuerL);

// Issuer Organization
NSLog(@"%@%@",@"O: ",cert.IssuerO);

// Issuer Organizational Unit
NSLog(@"%@%@",@"OU: ",cert.IssuerOU);

// Issuer State
NSLog(@"%@%@",@"S: ",cert.IssuerS);