(Objective-C) Verify the Timestamp Server Token (if any) while Validating a CMS Signature
Demonstrates how to also validate the timestamp server token (if any) while validating a CMS signature.
#import <CkoCrypt2.h>
#import <CkoJsonObject.h>
#import <NSString.h>
CkoCrypt2 *crypt = [[CkoCrypt2 alloc] init];
// Tell Chilkat to also validate the timestamp token if a timestamp exists in the CMS message's unauthenticated attributes.
CkoJsonObject *cmsOptions = [[CkoJsonObject alloc] init];
[cmsOptions UpdateBool: @"ValidateTimestampTokens" value: YES];
crypt.CmsOptions = [cmsOptions Emit];
NSString *outputFile = @"qa_output/original.xml";
NSString *inFile = @"qa_data/p7m/fattura_signature.xml.p7m";
// Verify the signature and extract the contained file, which in this case is XML.
BOOL success = [crypt VerifyP7M: inFile destPath: outputFile];
if (success == NO) {
NSLog(@"%@",crypt.LastErrorText);
return;
}
NSLog(@"%@",@"Signature validated.");
|