Click or drag to resize
MimeKit

IMultipartEncryptedDecrypt(DigitalSignatureCollection, CancellationToken) Method

Decrypts the IMultipartEncrypted part.

Namespace: MimeKit.Cryptography
Assembly: MimeKit (in MimeKit.dll) Version: 4.7.1
Syntax
C#
MimeEntity Decrypt(
	out DigitalSignatureCollection signatures,
	CancellationToken cancellationToken = default
)

Parameters

signatures  DigitalSignatureCollection
A list of digital signatures if the data was both signed and encrypted.
cancellationToken  CancellationToken  (Optional)
The cancellation token.

Return Value

MimeEntity
The decrypted entity.
Exceptions
ExceptionCondition
FormatException

The protocol parameter was not specified.

-or-

The multipart is malformed in some way.

NotSupportedException A suitable CryptographyContext for decrypting could not be found.
PrivateKeyNotFoundException The private key could not be found to decrypt the encrypted data.
ObjectDisposedException The IMultipartEncrypted has been disposed.
OperationCanceledException

The user chose to cancel the password prompt.

-or-

The operation was cancelled via the cancellation token.

UnauthorizedAccessException 3 bad attempts were made to unlock the secret key.
Remarks
Decrypts the IMultipartEncrypted and extracts any digital signatures in cases where the content was also signed.
See Also