|  | 
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
| (Delphi DLL) Extract PKCS7 from MIME and DecryptExtracts the base64-encoded PKCS7 body of a MIME message to a file, and then decrypts using Chilkat Crypt2. 
 uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Crypt2, Mime; ... procedure TForm1.Button1Click(Sender: TObject); var mime: HCkMime; success: Boolean; crypt: HCkCrypt2; inPath: PWideChar; outPath: PWideChar; begin // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. mime := CkMime_Create(); success := CkMime_LoadMimeFile(mime,'c:/aaworkarea/EmailInBytes.txt'); if (success <> True) then begin Memo1.Lines.Add(CkMime__lastErrorText(mime)); Exit; end; success := CkMime_SaveBody(mime,'c:/aaworkarea/smime.p7m'); if (success <> True) then begin Memo1.Lines.Add(CkMime__lastErrorText(mime)); Exit; end; crypt := CkCrypt2_Create(); success := CkCrypt2_AddPfxSourceFile(crypt,'c:/aaworkarea/my.pfx','pfxPassword'); if (success = False) then begin Memo1.Lines.Add(CkCrypt2__lastErrorText(crypt)); Exit; end; // Indicate the public-key (PKCS7) encryption/decryption should be used: CkCrypt2_putCryptAlgorithm(crypt,'pki'); inPath := 'c:/aaworkarea/smime.p7m'; outPath := 'c:/aaworkarea/decrypted.dat'; success := CkCrypt2_CkDecryptFile(crypt,inPath,outPath); if (success = False) then begin Memo1.Lines.Add(CkCrypt2__lastErrorText(crypt)); Exit; end; Memo1.Lines.Add('Success.'); CkMime_Dispose(mime); CkCrypt2_Dispose(crypt); end; | ||||
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.