Delphi ActiveX
Delphi ActiveX
Clear the S/MIME Recipient Certificate List
See more MIME Examples
Demonstrates ClearEncryptCerts, which empties the recipient-certificate list previously populated by AddEncryptCert. This is useful to start over with a different set of recipients before calling EncryptN.
Background. The recipient list is internal state that accumulates across AddEncryptCert calls. ClearEncryptCerts resets it so a subsequent EncryptN encrypts only for the certificates added afterward.
Chilkat Delphi ActiveX Downloads
var
success: Integer;
mime: TChilkatMime;
cert: TChilkatCert;
begin
success := 0;
mime := TChilkatMime.Create(Self);
success := mime.SetBodyFromPlainText('This message will be encrypted.');
if (success = 0) then
begin
Memo1.Lines.Add(mime.LastErrorText);
Exit;
end;
// Add a recipient certificate.
cert := TChilkatCert.Create(Self);
success := cert.LoadFromFile('qa_data/recipient.cer');
if (success = 0) then
begin
Memo1.Lines.Add(cert.LastErrorText);
Exit;
end;
success := mime.AddEncryptCert(cert.ControlInterface);
if (success = 0) then
begin
Memo1.Lines.Add(mime.LastErrorText);
Exit;
end;
// ClearEncryptCerts empties the recipient-certificate list, for example to start over with a
// different set of recipients before calling EncryptN. It is a void method.
mime.ClearEncryptCerts();
Memo1.Lines.Add('Recipient certificate list cleared.');