(Objective-C) Example: Crypt2.SetSigningCert method
Demonstrates how to call the SetSigningCert method.
#import <CkoCrypt2.h>
#import <CkoCert.h>
// Signing certificates can be obtained from many different sources..
// Load from a PFX
CkoCrypt2 *cryptA = [[CkoCrypt2 alloc] init];
CkoCert *certA = [[CkoCert alloc] init];
BOOL success = [certA LoadPfxFile: @"c:/someDir/pfx_files/a.pfx" password: @"pfx_file_password"];
success = [cryptA SetSigningCert: certA];
// ...
// Load from a smart card or USB token.
CkoCrypt2 *cryptB = [[CkoCrypt2 alloc] init];
CkoCert *certB = [[CkoCert alloc] init];
certB.SmartCardPin = @"123456";
success = [certB LoadFromSmartcard: @""];
success = [cryptB SetSigningCert: certB];
// ...
// Load from a the Windows certificate store or macOS keychain
CkoCrypt2 *cryptC = [[CkoCrypt2 alloc] init];
CkoCert *certC = [[CkoCert alloc] init];
success = [certC LoadByCommonName: @"Xyz 123"];
success = [cryptC SetSigningCert: certC];
// ...
|