Secure Mime ContextImport(String, String, Cancellation Token) Method
Import certificates and keys from a pkcs12 file.
Definition
Namespace: MimeKit.Cryptography
Assembly: MimeKit.Cryptography (in MimeKit.Cryptography.dll) Version: 5.0.0
Assembly: MimeKit.Cryptography (in MimeKit.Cryptography.dll) Version: 5.0.0
C#
public virtual void Import(
string fileName,
string password,
CancellationToken cancellationToken = default
)Parameters
- fileName String
- The raw certificate and key data in pkcs12 format.
- password String
- The password to unlock the stream.
- cancellationToken CancellationToken (Optional)
- The cancellation token.
Implements
ISecureMimeContextImport(String, String, CancellationToken)Remarks
Imports certificates and keys from a pkcs12 file.
Exceptions
| ArgumentNullException |
fileName is . -or- password is . |
| ArgumentException |
fileName is a zero-length string, contains only white space, or contains one or more invalid characters. -or- fileName does not contain a private key. -or- fileName does not contain a certificate that could be used for signing. |
| DirectoryNotFoundException | fileName is an invalid file path. |
| FileNotFoundException | The specified file path could not be found. |
| UnauthorizedAccessException | The user does not have access to read the specified file. |
| IOException | An I/O error occurred. |
| NotSupportedException | Importing keys is not supported by this cryptography context. |
| OperationCanceledException | The operation was cancelled via the cancellation token. |