Delphi Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

Delphi Examples

Bounced Mail
Character Encoding
Digital Certificates
Digital Signatures
Email
FTP
HTML-to-XML
HTTP
IMAP
Encryption
MHT / HTML Email
RSA Encryption
S/MIME
Socket
Spider
String
Tar
Upload
XML
XMP
Zip Compression

More Examples...
Byte Array
Email Object
POP3
SMTP
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA

Unreleased...
Bzip2
LZW
Bz2
Icon

Type Conversion

 

Article: Understanding COM References in Delphi

Create S/MIME Detached Signature with PFX

How to use a PFX to create a signed S/MIME message.

uses
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    Dialogs, StdCtrls,
    CHILKATMIMELib_TLB,
    CHILKATCERTIFICATELib_TLB,
    OleCtrls;

...

procedure TForm1.Button1Click(Sender: TObject);
var
mime: CHILKATMIMELib_TLB.IChilkatMime;
success: Integer;
certStore: CHILKATCERTIFICATELib_TLB.IChilkatCertStore;
password: String;
cert: IChilkatCert;

begin

mime := CoChilkatMime.Create();

success := mime.UnlockComponent('Anything for 30-day trial');
if (success = 0) then
  begin
    ShowMessage('Failed to unlock component');

  end;

mime.AddHeaderField('Subject','This is a test');
mime.AddHeaderField('Abc','123');

mime.SetBodyFromPlainText('This is the body');

certStore := CoChilkatCertStore.Create();

password := 'myPassword';
success := certStore.LoadPfxFile('chilkat.pfx',password);
if (success = 0) then
  begin
    ShowMessage(certStore.LastErrorText);

  end;

cert := certStore.FindCertBySubjectCN('Chilkat Software, Inc.');
if (cert = nil ) then
  begin
    ShowMessage('Failed to find certificate!');

  end;

//  Display the full distinguished name of the cert.
Memo1.Lines.Add(cert.SubjectDN);

success := mime.AddDetachedSignature(cert);
if (success = 0) then
  begin
    ShowMessage(mime.LastErrorText);

  end;

Memo1.Lines.Add(mime.GetMime());


end;

 

Need a specific example? Send a request to support@chilkatsoft.com

© 2000-2007 Chilkat Software, Inc. All Rights Reserved.

Mail Component · .NET Email Component · XML Parser