iText 8.0.5 API
iText.Signatures.SignatureUtil Class Reference

Utility class that provides several convenience methods concerning digital signatures. More...

Public Member Functions

  SignatureUtil (PdfDocument document)
  Creates a SignatureUtil instance. More...
 
virtual PdfPKCS7  ReadSignatureData (String signatureFieldName)
  Prepares an PdfPKCS7 instance for the given signature. More...
 
virtual PdfSignature  GetSignature (String name)
  Get PdfSignature dictionary based on the provided name. More...
 
virtual PdfDictionary  GetSignatureDictionary (String name)
  Gets the signature dictionary, the one keyed by /V. More...
 
virtual PdfDictionary  GetSignatureFormFieldDictionary (String name)
 
virtual IList< String >  GetSignatureNames ()
  Gets the field names that have signatures and are signed. More...
 
virtual IList< String >  GetBlankSignatureNames ()
  Gets the field names that have blank signatures. More...
 
virtual int  GetTotalRevisions ()
  Get the amount of signed document revisions. More...
 
virtual int  GetRevision (String field)
  Get signed document revision number, which corresponds to the provided signature name. More...
 
virtual String  GetTranslatedFieldName (String name)
  Get field name, translated using XFA, if any present in the document. More...
 
virtual Stream  ExtractRevision (String field)
  Extracts a revision from the document. More...
 
virtual bool  SignatureCoversWholeDocument (String name)
  Checks if the signature covers the entire document (except for signature's Contents) or just a part of it. More...
 
virtual bool  DoesSignatureFieldExist (String name)
  Checks whether a name exists as a signature field or not. More...
 

Detailed Description

Utility class that provides several convenience methods concerning digital signatures.

Constructor & Destructor Documentation

◆ SignatureUtil()

iText.Signatures.SignatureUtil.SignatureUtil ( PdfDocument  document )
inline

Creates a SignatureUtil instance.

Creates a SignatureUtil instance. Sets the acroForm field to the acroForm in the PdfDocument. iText will create a new AcroForm if the PdfDocument doesn't contain one.

Parameters
document PdfDocument to be inspected

Member Function Documentation

◆ DoesSignatureFieldExist()

virtual bool iText.Signatures.SignatureUtil.DoesSignatureFieldExist ( String  name )
inlinevirtual

Checks whether a name exists as a signature field or not.

Checks whether a name exists as a signature field or not. It checks both signed fields and blank signatures.

Parameters
name name of the field
Returns
boolean does the signature field exist

◆ ExtractRevision()

virtual Stream iText.Signatures.SignatureUtil.ExtractRevision ( String  field )
inlinevirtual

Extracts a revision from the document.

Parameters
field the signature field name
Returns
an InputStream covering the revision. Returns null if it's not a signature field

◆ GetBlankSignatureNames()

virtual IList iText.Signatures.SignatureUtil.GetBlankSignatureNames ( )
inlinevirtual

Gets the field names that have blank signatures.

Returns
List containing the field names that have blank signatures

◆ GetRevision()

virtual int iText.Signatures.SignatureUtil.GetRevision ( String  field )
inlinevirtual

Get signed document revision number, which corresponds to the provided signature name.

Parameters
field signature name
Returns

int revision number

◆ GetSignature()

virtual PdfSignature iText.Signatures.SignatureUtil.GetSignature ( String  name )
inlinevirtual

Get PdfSignature dictionary based on the provided name.

Parameters
name signature name
Returns

PdfSignature instance corresponding to the provided name. null otherwise

◆ GetSignatureDictionary()

virtual PdfDictionary iText.Signatures.SignatureUtil.GetSignatureDictionary ( String  name )
inlinevirtual

Gets the signature dictionary, the one keyed by /V.

Parameters
name the field name
Returns
the signature dictionary keyed by /V or null if the field is not a signature

◆ GetSignatureNames()

virtual IList iText.Signatures.SignatureUtil.GetSignatureNames ( )
inlinevirtual

Gets the field names that have signatures and are signed.

Returns
List containing the field names that have signatures and are signed

◆ GetTotalRevisions()

virtual int iText.Signatures.SignatureUtil.GetTotalRevisions ( )
inlinevirtual

Get the amount of signed document revisions.

Returns

int amount of signed document revisions

◆ GetTranslatedFieldName()

virtual String iText.Signatures.SignatureUtil.GetTranslatedFieldName ( String  name )
inlinevirtual

Get field name, translated using XFA, if any present in the document.

Parameters
name field name to be translated
Returns
translated field name if XFA is present, original name otherwise

◆ ReadSignatureData()

virtual PdfPKCS7 iText.Signatures.SignatureUtil.ReadSignatureData ( String  signatureFieldName )
inlinevirtual

Prepares an PdfPKCS7 instance for the given signature.

Prepares an PdfPKCS7 instance for the given signature. This method handles signature parsing and might throw an exception if signature is malformed.

The returned PdfPKCS7 can be used to fetch additional info about the signature and also to perform integrity check of data signed by the given signature field.

Prepared PdfPKCS7 instance calculates digest based on signature's /ByteRange entry. In order to check that /ByteRange is properly defined and given signature indeed covers the current PDF document revision please use SignatureCoversWholeDocument(System.String) method.

Parameters
signatureFieldName the signature field name
Returns
a PdfPKCS7 instance which can be used to fetch additional info about the signature and also to perform integrity check of data signed by the given signature field.

◆ SignatureCoversWholeDocument()

virtual bool iText.Signatures.SignatureUtil.SignatureCoversWholeDocument ( String  name )
inlinevirtual

Checks if the signature covers the entire document (except for signature's Contents) or just a part of it.

Checks if the signature covers the entire document (except for signature's Contents) or just a part of it.

If this method does not return true it means that signature in question does not cover the entire contents of current iText.Kernel.Pdf.PdfDocument . Such signatures cannot be considered as verifying the PDF document, because content that is not covered by signature might have been modified since the signature creation.

Parameters
name the signature field name
Returns
true if the signature covers the entire document, false if it doesn't