Mime |
public void SignAndEncrypt( CryptographyContext ctx, DigestAlgorithm digestAlgo, CancellationToken cancellationToken = default )
Exception | Condition |
---|---|
ArgumentNullException | ctx is null. |
ArgumentException | An unknown type of cryptography context was used. |
ArgumentOutOfRangeException | The digestAlgo was out of range. |
InvalidOperationException | The Body has not been set. -or- No sender has been specified. -or- No recipients have been specified. |
NotSupportedException | The digestAlgo is not supported. |
OperationCanceledException | The operation was canceled via the cancellation token. |
CertificateNotFoundException | A certificate could not be found for the signer or one or more of the recipients. |
PrivateKeyNotFoundException | The private key could not be found for the sender. |
PublicKeyNotFoundException | The public key could not be found for one or more of the recipients. |
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.
Likewise, if either of the Resent-Sender or Resent-From headers are set, then the message will be encrypted to all of the addresses specified in the Resent headers (Resent-Sender, Resent-From, Resent-To, Resent-Cc, and Resent-Bcc), otherwise the message will be encrypted to all of the addresses specified in the standard address headers (Sender, From, To, Cc, and Bcc).