Click or drag to resize
MimeKit

MimeMessageSignAsync(CryptographyContext, CancellationToken) Method

Asynchronously sign the message using the specified cryptography context and the SHA-1 digest algorithm.

Namespace: MimeKit
Assembly: MimeKit (in MimeKit.dll) Version: 4.7.1
Syntax
C#
public Task SignAsync(
	CryptographyContext ctx,
	CancellationToken cancellationToken = default
)

Parameters

ctx  CryptographyContext
The cryptography context.
cancellationToken  CancellationToken  (Optional)
The cancellation token.

Return Value

Task
An asynchronous task context.
Exceptions
ExceptionCondition
ArgumentNullExceptionctx is null.
InvalidOperationException

The Body has not been set.

-or-

A sender has not been specified.

OperationCanceledException The operation was canceled via the cancellation token.
CertificateNotFoundException A signing certificate could not be found for the sender.
PrivateKeyNotFoundException The private key could not be found for the sender.
Remarks
If either of the Resent-Sender or Resent-From headers are set, then the message will be signed using the Resent-Sender (or first mailbox in the Resent-From) address as the signer address, otherwise the Sender or From address will be used instead.
See Also