TemporarySecureMimeContextImportAsync(X509Certificate, Boolean, CancellationToken) Method

Asynchronously import a certificate and explicitly set its trust.

Definition

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

Parameters

certificate  X509Certificate
The certificate.
trusted  Boolean
Whether the certificate is a trusted anchor.
cancellationToken  CancellationToken  (Optional)
The cancellation token.

Return Value

Task
An asynchronous task context.

Remarks

Only certificates explicitly imported with trusted set to are used as trust anchors. Ordinary imports do not grant trust or change existing trust.

Passing removes any previously granted trust.

Exceptions

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

See Also