Click or drag to resize
MimeKit

OpenPgpContextDecrypt(Stream, CancellationToken) Method

Decrypt the specified encryptedData.

Namespace: MimeKit.Cryptography
Assembly: MimeKit (in MimeKit.dll) Version: 4.7.1
Syntax
C#
public override MimeEntity Decrypt(
	Stream encryptedData,
	CancellationToken cancellationToken = default
)

Parameters

encryptedData  Stream
The encrypted data.
cancellationToken  CancellationToken  (Optional)
The cancellation token.

Return Value

MimeEntity
The decrypted MimeEntity.

Implements

ICryptographyContextDecrypt(Stream, CancellationToken)
Exceptions
ExceptionCondition
ArgumentNullExceptionencryptedData is null.
PrivateKeyNotFoundException The private key could not be found to decrypt the stream.
OperationCanceledException

The user chose to cancel the password prompt.

-or-

The operation was canceled via the cancellation token.

UnauthorizedAccessException 3 bad attempts were made to unlock the secret key.
PgpException An OpenPGP error occurred.
Remarks
Decrypts the specified encryptedData.
See Also