Add and scan selected pages from the document.

 

   

Syntax
 

[C#]
Signature AddDocumentTimestamp(Signature.SigningDelegate signer, Oid digestAlgorithm, int size)
Signature AddDocumentTimestamp(Uri uri, Oid digestAlgorithm, int size)

[Visual Basic]
Function AddDocumentTimestamp(signer As Signature.SigningDelegate, digestAlgorithm As Oid, size As Integer)
Function AddDocumentTimestamp(uri As Uri, digestAlgorithm As Oid, size As Integer)

 

   

Params
 
Name Description
signer The custom timestamp signing delegate. This delegate should return a PKCS7 formatted CMS timestamp.
uri The URI of the Timestamping Authority server.
digestAlgorithm The hash algorithm to use to create the digest of the document data to be timestamped, for example new Oid("SHA256").
size The number of bytes to reserve for the returned signed timestamp data. A typical value might be in the region of 5000. If the value is too small an exception will be raised.
return The document timestamp Signature object.

 

   

Notes
 

A document timestamp is a special type of signature. A detailed explanation can be found in ETSI TS 119 142-3

Please see Signature.CustomerSigner for the functionality required of the delegate.

Permitted digest algorithms are SHA256, SHA384 and SHA512. MD5 and SHA1 are also accepted but not recommended.

If the document timestamp larger than the number of bytes specified in size, an exception will be thrown. Some timestamping servers can return large timestamps.

A document timestamp always creates a new version of the pdf.

 

   

Example
 

This example shows how to use a custom timestamp signing delegate.

[C#]
byte[] CustomTimestampDelegate(byte[] data) {
  return myExternalTimestamper(data);
}

using(Doc doc = new Doc()) {
  doc.Read("toTimestamp.pdf"));
  var tsOp = new FormOperation(doc);
  Signature ts = tsOp.AddDocumentTimestamp(CustomTimestampDelegate, new Oid("SHA512"), 6000);
  doc.Save("timestamped.pdf");
}

[Visual Basic]
Private Function CustomTimestampDelegate(data() As Byte) As Byte()
  Return myExternalTimestamper(data)
End Function

Dim doc As Doc
doc.Read("toTimestamp.pdf")
Dim tsOp As var = New FormOperation(doc)
Dim ts As Signature = tsOp.AddDocumentTimestamp(CustomTimestampDelegate, New Oid("SHA512"), 6000)
doc.Save("timestamped.pdf")