MultipartEncryptedDecrypt(OpenPgpContext, DigitalSignatureCollection, CancellationToken) Method

Decrypts the MultipartEncrypted part.

Definition

Namespace: MimeKit.Cryptography
Assembly: MimeKit.Cryptography (in MimeKit.Cryptography.dll) Version: 5.0.0
C#
public MimeEntity Decrypt(
	OpenPgpContext ctx,
	out DigitalSignatureCollection?? signatures,
	CancellationToken cancellationToken = default
)

Parameters

ctx  OpenPgpContext
The OpenPGP cryptography context to use for decrypting.
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.

Implements

IMultipartEncryptedDecrypt(OpenPgpContext, DigitalSignatureCollection, CancellationToken)

Remarks

Decrypts the MultipartEncrypted and extracts any digital signatures in cases where the content was also signed.

Exceptions

ArgumentNullException ctx is .
FormatException

The protocol parameter was not specified.

-or-

The multipart is malformed in some way.

NotSupportedException The provided OpenPgpContext does not support the protocol parameter.
PrivateKeyNotFoundException The private key could not be found to decrypt the encrypted data.
ObjectDisposedException The MultipartEncrypted 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.

See Also