WindowsSecureMimeContextEncryptAsync(CmsRecipientCollection, Stream, CancellationToken) Method

Asynchronously 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 override Task<ApplicationPkcs7Mime> EncryptAsync(
	CmsRecipientCollection recipients,
	Stream content,
	CancellationToken cancellationToken = default
)

Parameters

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

Return Value

TaskApplicationPkcs7Mime
A new ApplicationPkcs7Mime instance containing the encrypted content.

Implements

ISecureMimeContextEncryptAsync(CmsRecipientCollection, Stream, CancellationToken)

Remarks

Asynchronously encrypts the specified content for the specified recipients.

Exceptions

ArgumentNullException

recipients is .

-or-

content is .

ArgumentException recipients is empty.
OperationCanceledException The operation was canceled via the cancellation token.
CryptographicException An error occurred in the cryptographic message syntax subsystem.

See Also