Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
S/MIME Signed MessageCreate an S/MIME signed (PKCS7) 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; cert: TChilkatCert; begin mime := CoChilkatMime.Create(); success := mime.UnlockComponent('Anything for 30-day trial.'); if (success = 0) then begin ShowMessage(mime.LastErrorText); Exit; end; mime.AddHeaderField('Subject','This is a test'); mime.AddHeaderField('Abc','123'); mime.SetBodyFromPlainText('This is the body'); cert := TChilkatCert.Create(Self); // Load a certificate that has already been installed (from a .pfx) // on the computer: success := cert.LoadByEmailAddress('thawte@chilkatsoft.com'); if (success = 0) then begin ShowMessage(cert.LastErrorText); Exit; end; // Convert to a signed message. success := mime.ConvertToSigned(cert.ControlInterface As CHILKATMIMELib_TLB.IChilkatCert); if (success = 0) then begin ShowMessage(mime.LastErrorText); Exit; end; // Display the signed MIME: Memo1.Lines.Add(mime.GetMime()); Memo1.Lines.Add('----'); // Unwrap to restore the original MIME. success := mime.UnwrapSecurity(); if (success = 0) then begin ShowMessage(mime.LastErrorText); Exit; end; // Display the restored (unsigned) MIME: 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.