![]() |
Chilkat • HOME • Android™ • AutoIt • C • C# • C++ • Chilkat2-Python • CkPython • Classic ASP • DataFlex • Delphi DLL • Go • Java • Node.js • Objective-C • PHP Extension • Perl • PowerBuilder • PowerShell • PureBasic • Ruby • SQL Server • Swift • Tcl • Unicode C • Unicode C++ • VB.NET • VBScript • Visual Basic 6.0 • Visual FoxPro • Xojo Plugin
(PureBasic) Extract PKCS7 from MIME and DecryptExtracts the base64-encoded PKCS7 body of a MIME message to a file, and then decrypts using Chilkat Crypt2.
IncludeFile "CkCrypt2.pb" IncludeFile "CkMime.pb" Procedure ChilkatExample() ; This example assumes the Chilkat API to have been previously unlocked. ; See Global Unlock Sample for sample code. mime.i = CkMime::ckCreate() If mime.i = 0 Debug "Failed to create object." ProcedureReturn EndIf success.i = CkMime::ckLoadMimeFile(mime,"c:/aaworkarea/EmailInBytes.txt") If success <> 1 Debug CkMime::ckLastErrorText(mime) CkMime::ckDispose(mime) ProcedureReturn EndIf success = CkMime::ckSaveBody(mime,"c:/aaworkarea/smime.p7m") If success <> 1 Debug CkMime::ckLastErrorText(mime) CkMime::ckDispose(mime) ProcedureReturn EndIf crypt.i = CkCrypt2::ckCreate() If crypt.i = 0 Debug "Failed to create object." ProcedureReturn EndIf success = CkCrypt2::ckAddPfxSourceFile(crypt,"c:/aaworkarea/my.pfx","pfxPassword") If success = 0 Debug CkCrypt2::ckLastErrorText(crypt) CkMime::ckDispose(mime) CkCrypt2::ckDispose(crypt) ProcedureReturn EndIf ; Indicate the public-key (PKCS7) encryption/decryption should be used: CkCrypt2::setCkCryptAlgorithm(crypt, "pki") inPath.s = "c:/aaworkarea/smime.p7m" outPath.s = "c:/aaworkarea/decrypted.dat" success = CkCrypt2::ckCkDecryptFile(crypt,inPath,outPath) If success = 0 Debug CkCrypt2::ckLastErrorText(crypt) CkMime::ckDispose(mime) CkCrypt2::ckDispose(crypt) ProcedureReturn EndIf Debug "Success." CkMime::ckDispose(mime) CkCrypt2::ckDispose(crypt) ProcedureReturn EndProcedure |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.