PdfDigitalSignatureDetails Class

Contains details for signing a PDF document with a digital signature.

Inheritance Hierarchy


Namespace:  Aspose.Words.Saving
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.7.0


public class PdfDigitalSignatureDetails

The PdfDigitalSignatureDetails type exposes the following members.



Public propertyCertificateHolder
Returns the certificate holder object that contains the certificate was used to sign the document.
Public propertyCode exampleHashAlgorithm
Gets or sets the hash algorithm.
Public propertyCode exampleLocation
Gets or sets the location of the signing.
Public propertyCode exampleReason
Gets or sets the reason for the signing.
Public propertyCode exampleSignatureDate
Gets or sets the date of the signing.
Public propertyCode exampleTimestampSettings
Gets or sets the digital signature timestamp settings.


Public methodEquals (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Public methodToString (Inherited from Object.)


At the moment digitally signing PDF documents is only available on .NET 2.0 or higher.

To digitally sign a PDF document when it is created by Aspose.Words, set the DigitalSignatureDetails property to a valid PdfDigitalSignatureDetails object and then save the document in the PDF format passing the PdfSaveOptions as a parameter into the Save(String, SaveOptions) method.

Aspose.Words 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.


Shows how to sign a generated PDF using Aspose.Words.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Writeln("Signed PDF contents.");

// Load the certificate from disk
// The other constructor overloads can be used to load certificates from different locations
CertificateHolder certificateHolder = CertificateHolder.Create(MyDir + "morzal.pfx", "aw");

// Pass the certificate and details to the save options class to sign with
PdfSaveOptions options = new PdfSaveOptions();
DateTime signingTime = DateTime.Now;
options.DigitalSignatureDetails = new PdfDigitalSignatureDetails(certificateHolder, "Test Signing", "Aspose Office", signingTime);

// We can use this attribute to set a different hash algorithm
options.DigitalSignatureDetails.HashAlgorithm = PdfDigitalSignatureHashAlgorithm.Sha256;

Assert.AreEqual("Test Signing", options.DigitalSignatureDetails.Reason);
Assert.AreEqual("Aspose Office", options.DigitalSignatureDetails.Location);
Assert.AreEqual(signingTime.ToUniversalTime(), options.DigitalSignatureDetails.SignatureDate);

doc.Save(ArtifactsDir + "PdfSaveOptions.PdfDigitalSignature.pdf", options);

See Also