PdfDigitalSignatureDetails Class
Wordize.Saving.PdfDigitalSignatureDetails class. Contains details for signing a PDF document with a digital signature.
PdfDigitalSignatureDetails class
Contains details for signing a PDF document with a digital signature.
public class PdfDigitalSignatureDetails
Constructors
Name | Description |
---|---|
PdfDigitalSignatureDetails(CertificateHolder, string, string, DateTime) | Initializes an instance of this class. |
Properties
Name | Description |
---|---|
CertificateHolder { get; } | Returns the certificate holder object that contains the certificate was used to sign the document. |
HashAlgorithm { get; set; } | Gets or sets the hash algorithm. |
Location { get; set; } | Gets or sets the location of the signing. |
Reason { get; set; } | Gets or sets the reason for the signing. |
SignatureDate { get; set; } | Gets or sets the date of the signing. |
TimestampSettings { get; set; } | Gets or sets the digital signature timestamp settings. |
Remarks
To digitally sign a PDF document, set the DigitalSignatureDetails
property to a valid PdfDigitalSignatureDetails
object.
Wordize creates a PKCS#7 signature over the whole PDF document and uses the “Adobe.PPKMS” filter and “adbe.pkcs7.sha1” subfilter when creating a digital signature.
Examples
Shows how to configure digital signature details in PDF save options.
CertificateHolder certHolder = CertificateHolder.Create(MyDir + "morzal.pfx", "aw");
PdfDigitalSignatureDetails signatureDetails = new PdfDigitalSignatureDetails(certHolder, "Test", "Kharkov", DateTime.Now);
signatureDetails.HashAlgorithm = PdfDigitalSignatureHashAlgorithm.Sha512;
signatureDetails.TimestampSettings = new PdfDigitalSignatureTimestampSettings("https://freetsa.org/tsr", "Wordize", "1234", TimeSpan.FromSeconds(100));
// Check Timestamp details.
Assert.That(signatureDetails.TimestampSettings.Timeout.TotalSeconds, Is.EqualTo(100.0d));
Assert.That(signatureDetails.TimestampSettings.ServerUrl, Is.EqualTo("https://freetsa.org/tsr"));
Assert.That(signatureDetails.TimestampSettings.UserName, Is.EqualTo("Wordize"));
Assert.That(signatureDetails.TimestampSettings.Password, Is.EqualTo("1234"));
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.DigitalSignatureDetails = signatureDetails;
Converter.Create()
.From(MyDir + "Simple.docx")
.To(ArtifactsDir + "PdfSaveOptions.DigitalSignatureDetails.pdf", pdfSaveOptions)
.Execute();
See Also
- namespace Wordize.Saving
- assembly Wordize