encrypt method
Encrypts the current MIME entity for the recipient certificate in cert
and replaces it with CMS/PKCS #7 encrypted S/MIME. cert must be
RSA-based. Only the recipient's public key is needed to encrypt; the
matching private key is required later to decrypt.
The default content encryption is AES-128-CBC. pkcs7CryptAlg and
pkcs7KeyLength select the symmetric algorithm and key length. By
default, RSAES-PKCS1-v1_5 transports the content-encryption key; set
oaepPadding to true to use RSAES-OAEP, with oaepHash and
oaepMgfHash controlling its parameters.
The generated MIME uses Base64 transfer encoding, the filename
smime.p7m, and an application/x-pkcs7-mime or application/pkcs7-mime
content type according to useXPkcs7. After encryption,
getDecryptCertInfo can report the recipient identifiers stored in the
CMS data. If encryption fails, the original MIME remains unchanged.
Throws a ChilkatException if the call fails; the details are in ChilkatException.lastErrorText.
Implementation
void encrypt(CkCert cert) {
final h = _handle;
final r = _CkMime_Encrypt(h, cert._handle);
if (r == 0) {
throw _fail('encrypt');
}
}