Cms Signer(String, String, Subject Identifier Type) Constructor
Initialize a new instance of the CmsSigner class.
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 CmsSigner(
string fileName,
string password,
SubjectIdentifierType signerIdentifierType = SubjectIdentifierType.IssuerAndSerialNumber
)Parameters
- fileName String
- The raw certificate and key data in pkcs12 format.
- password String
- The password to unlock the stream.
- signerIdentifierType SubjectIdentifierType (Optional)
- The scheme used for identifying the signer certificate.
Remarks
Creates a new CmsSigner, loading the X.509 certificate and private key from the specified file.
The initial value of the DigestAlgorithm will be set to Sha256 and both the SignedAttributes and UnsignedAttributes properties will be initialized to empty tables.
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. |