PHP
Chilkat2 PHP
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 PHP Downloads
<?php
use Chilkat2\Cert;
use Chilkat2\Mime;
$mime = new Mime();
try {
$mime->SetBodyFromPlainText('This message will be encrypted.');
// Add a recipient certificate.
$cert = new Cert();
$cert->LoadFromFile('qa_data/recipient.cer');
$mime->AddEncryptCert($cert);
} catch (\Chilkat2\Exception $e) {
echo $e->getMessage(), "\n";
exit;
}
// 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();
echo "Recipient certificate list cleared.\n";