Objective-C
Objective-C
DSA Public Key PEM to DER Conversion
See more DSA Examples
Converts a DSA public key from PEM format to DER.Chilkat Objective-C Downloads
#import <CkoDsa.h>
#import <NSString.h>
BOOL success = NO;
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkoDsa *dsa = [[CkoDsa alloc] init];
// Load a PEM public key.
NSString *pemPublicKey = 0;
pemPublicKey = [dsa LoadText: @"dsa_pub.pem"];
// Import the public key PEM into the DSA object.
success = [dsa FromPublicPem: pemPublicKey];
if (success != YES) {
NSLog(@"%@",dsa.LastErrorText);
return;
}
// Write it out as a DER file:
success = [dsa ToPublicDerFile: @"dsa_pub.der"];
if (success != YES) {
NSLog(@"%@",dsa.LastErrorText);
return;
}
NSLog(@"%@",@"Finished!");