DefaultSecureMimeContextImportAsync(Stream, Boolean, CancellationToken) Method

Asynchronously import a DER-encoded certificate stream.

Definition

Namespace: MimeKit.Cryptography
Assembly: MimeKit.Cryptography (in MimeKit.Cryptography.dll) Version: 5.0.0
C#
public Task ImportAsync(
	Stream stream,
	bool trusted,
	CancellationToken cancellationToken = default
)

Parameters

stream  Stream
The raw certificate(s).
trusted  Boolean
if the certificates are trusted; othewrwise, .
cancellationToken  CancellationToken  (Optional)
The cancellation token.

Return Value

Task
An asynchronous task context.

Remarks

Asynchronously imports the certificate(s).

  Note

The certificate database is accessed synchronously because IX509CertificateDatabase does not provide asynchronous APIs, so this method will block the calling thread until the import has completed.

Exceptions

ArgumentNullException stream is .
OperationCanceledException The operation was canceled via the cancellation token.

See Also