Chilkat HOME Android™ ASP Visual Basic VB.NET C# iOS (IPhone) Objective-C C++ C Unicode C++ Unicode C MFC Delphi DLL Delphi ActiveX FoxPro Java Perl PHP Extension PHP ActiveX Python PowerShell Ruby SQL Server VBScript
|
(IOS) Extract PKCS7 from MIME and DecryptExtracts the base64-encoded PKCS7 body of a MIME message to a file, and then decrypts using Chilkat Crypt2. Download: Chilkat IOS (IPhone) Objective-C Libraries NSMutableString *strOutput = [NSMutableString stringWithCapacity:1000]; CkoMime *mime = [[[CkoMime alloc] init] autorelease]; BOOL success; success = [mime UnlockComponent: @"Anything for 30-day trial"]; if (success == NO) { [strOutput appendString: mime.LastErrorText]; [strOutput appendString: @"\n"]; self.mainTextField.stringValue = strOutput; return; } success = [mime LoadMimeFile: @"c:/aaworkarea/EmailInBytes.txt"]; if (success != YES) { [strOutput appendString: mime.LastErrorText]; [strOutput appendString: @"\n"]; self.mainTextField.stringValue = strOutput; return; } success = [mime SaveBody: @"c:/aaworkarea/smime.p7m"]; if (success != YES) { [strOutput appendString: mime.LastErrorText]; [strOutput appendString: @"\n"]; self.mainTextField.stringValue = strOutput; return; } CkoCrypt2 *crypt = [[[CkoCrypt2 alloc] init] autorelease]; success = [crypt UnlockComponent: @"Anything for 30-day trial"]; if (success == NO) { [strOutput appendString: crypt.LastErrorText]; [strOutput appendString: @"\n"]; self.mainTextField.stringValue = strOutput; return; } success = [crypt AddPfxSourceFile: @"c:/aaworkarea/my.pfx" password: @"pfxPassword"]; if (success == NO) { [strOutput appendString: crypt.LastErrorText]; [strOutput appendString: @"\n"]; self.mainTextField.stringValue = strOutput; return; } // Indicate the public-key (PKCS7) encryption/decryption should be used: crypt.CryptAlgorithm = @"pki"; NSString *inPath; inPath = @"c:/aaworkarea/smime.p7m"; NSString *outPath; outPath = @"c:/aaworkarea/decrypted.dat"; success = [crypt CkDecryptFile: inPath outFile: outPath]; if (success == NO) { [strOutput appendString: crypt.LastErrorText]; [strOutput appendString: @"\n"]; self.mainTextField.stringValue = strOutput; return; } [strOutput appendString: @"Success."]; [strOutput appendString: @"\n"]; self.mainTextField.stringValue = strOutput; |
© 2000-2013 Chilkat Software, Inc. All Rights Reserved.