CmsInformation Class |
Namespace: Atalasoft.PdfDoc.DigitalSignatures
The CmsInformation type exposes the following members.
Name | Description | |
---|---|---|
CmsInformation(X509Certificate2Collection) |
Initializes a new instance of the CmsInformation class.
| |
CmsInformation(X509Certificate2Collection, PdfContentDigestMethod, UnsupportedContentDigestAlgorithmAction) |
Initializes a new instance of the CmsInformation class.
| |
CmsInformation(Stream, SecureString, PdfContentDigestMethod, UnsupportedContentDigestAlgorithmAction) |
Initializes a new instance of the CmsInformation class.
|
Name | Description | |
---|---|---|
Certificates |
Gets the certificates collection. This represents the certificate or
chain of certificates used to sign the document. The actual signer will
always be the first.
| |
ContentDigestMethod |
Gets the content digest method that will be used to create a message digest of the PDF file.
Note that this is currently only used for signature creation and not for reflecting the method used in a signed file. | |
ContentDigestMethodIsSupported |
Gets a value indicating whether the ContentDigestMethod is supported by the provided certificate
if it is supported, it will be used as is. If it is unsupported, at the time of saving the document (in PdfDocument
or PdfGeneratedDocument) or signing (in PdfDocumentSigner), the UnsupportedContentDigestAlgorithmAction
will be invoked.
| |
UnsupportedContentDigestAlgorithmAction |
Gets the action that will be taken when the ContentDigestMethod is not supported.
|
Name | Description | |
---|---|---|
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Otherwise, the property ContentDigestMethodIsSupported will be false and at the time of signing, DotPdf will invoke the action in the property UnsupportedContentDigestAlgorithmAction. Almost certainly, certificates that come from the Windows certificate store will NOT have an exportable private key.
X509Certificate2 cert = new X509Certificate2(pathToACertFile, yourCertPassword, X509KeyStorageFlags.Exportable);
public IList<PdfContentDigestMethod> GetSupportedDigestMethods(X509Certificate2Collection certificates) { List<PdfContentDigestMethod> meths = new List<PdfContentDigestMethod>(); foreach (PdfContentDigestMethod method in Enum.GetValues(typeof(PdfContentDigestMethod))) { CmsInformation cms = new CmsInformation(certificate, method, UnsupportedContentDigestAlgorithmAction.FallBackToSHA1); if (cms.ContentDigestMethodIsSupported) meths.Add(method); } return meths; }