Click or drag to resize
MimeKit

DefaultSecureMimeContextImportAsync(X509Certificate, Boolean, CancellationToken) Method

Asynchronously import a certificate.

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

Parameters

certificate  X509Certificate
The certificate.
trusted  Boolean
true if the certificate is trusted; otherwise, false.
cancellationToken  CancellationToken  (Optional)
The cancellation token.

Return Value

Task
An asynchronous task context.
Exceptions
ExceptionCondition
ArgumentNullExceptioncertificate is null.
OperationCanceledException The operation was canceled via the cancellation token.
Remarks

Asynchronously imports the certificate.

If the certificate already exists in the database and trusted is true, then the IsTrusted state is updated otherwise the certificate is added to the database with the specified trust.

See Also