Adding a Timestamp to Signatures and Certificates

Add a timestamp to a signature to show the date and time a document was signed. Both visible and non-visible signatures can be time stamped.

Specifying a Timestamp Server URL

If a signature is time stamped from a timestamp server, then create a TimeStampServer instance. Pass the TimeStampServer object's timestamp server URL and, if necessary, the connection's user name and password. The TimeStampServer object is then passed to the Document's Sign method along with the certificate and the signature field name.

Usage

This following example illustrates using a TimeStampServer instance to specify a server URL that timestamps a signature.

Document document = new Document(); 
Page page = new Page(); 

// Create  add Signature Form Field
Signature signature = new Signature("SigField", 10, 10, 250, 100); 
page.Elements.Add(signature); 
document.Pages.Add(page); 
Certificate certificate = new Certificate(@"C:\PersonalFiles\JohnDoe.pfx", "password"); 

// Create TimestampServer
TimestampServer timestampServer = new TimestampServer("Url of the Timestamp Server");
document.Sign("SigField", certificate, timestampServer);
document.Draw(pdfFilePath);         
Dim MyDocument As New Document()
Dim MyPage As New Page()

' Create & add Signature Form Field 
Dim MySignature As New Signature("SigField", 10, 10, 250, 100)
MyPage.Elements.Add(MySignature)
MyDocument.Pages.Add(MyPage)
Dim MyCertificate As New Certificate("C:\Data\JohnDoe.pfx"), "password")

' Create TimestampServer 
Dim MyTimestampServer As New TimestampServer("Url of the Timestamp Server")
MyDocument.Sign("SigField", MyCertificate, MyTimestampServer)
MyDocument.Draw(pdfFilePath)    

Using a Timestamp Server URL from a Certificate

If the certificate used in a Signature Field already contains a timestamp server URL, then you can use this URL. Creating a separate TimeStampServer instance is not necessary. Instead, use the Document Sign method overload that accepts a Signature Filed Name, a Certificate object and a Boolean value. Set this Boolean value to true specifies that the signature is time stamped using the details present in the Certificate object.

It is worth noting here that you checking Certificates TimeStampServer property will allow you to determine if there is a TimeStamp Server already specified or not. If the Certificate contains a URL then this property will return it otherwise it will return a Null. This example demonstrates how to use a Timestamp server URL that was already specified in a Certificate object.

Document document = new Document(); 
Page page = new Page(); 

// Create & add Signature Form Field
Signature signature = new Signature("SigField", 10, 10, 250, 100); 
page.Elements.Add(signature); 
document.Pages.Add(page); 
Certificate certificate = new Certificate(@"C:\PersonalFiles\JohnDoe.pfx", "password"); 
document.Sign("SigField", certificate, true);
document.Draw(pdfFilePath);        
Dim MyDocument As New Document()
Dim MyPage As New Page()

' Create  add Signature Form Field 
Dim MySignature As New Signature("SigField", 10, 10, 250, 100)
MyPage.Elements.Add(MySignature)
MyDocument.Pages.Add(MyPage)
Dim MyCertificate As New Certificate("C:\Data\JohnDoe.pfx", "password")

MyDocument.Sign("SigField", MyCertificate, True)
MyDocument.Draw(pdfFilePath)

In this topic