CryptographyContextEncrypt Method

Encrypt the specified content for the specified recipients.

Definition

Namespace: MimeKit.Cryptography
Assembly: MimeKit.Cryptography (in MimeKit.Cryptography.dll) Version: 5.0.0
C#
public abstract MimePart Encrypt(
	IEnumerable<MailboxAddress> recipients,
	Stream content,
	CancellationToken cancellationToken = default
)

Parameters

recipients  IEnumerableMailboxAddress
The recipients.
content  Stream
The content.
cancellationToken  CancellationToken  (Optional)
The cancellation token.

Return Value

MimePart
A new MimePart instance containing the encrypted data.

Implements

ICryptographyContextEncrypt(IEnumerableMailboxAddress, Stream, CancellationToken)

Remarks

Encrypts the specified content for the specified recipients.

Exceptions

ArgumentNullException

recipients is .

-or-

content is .

OperationCanceledException The operation was canceled via the cancellation token.
CertificateNotFoundException A certificate could not be found for one or more of the recipients.

See Also