iText 8.0.5 API
iText.Signatures.PdfSigner Class Reference

Takes care of the cryptographic options and appearances that form a signature. More...

Classes

interface   ISignatureEvent
  An interface to retrieve the signature dictionary for modification. More...
 

Public Types

enum   CryptoStandard { CryptoStandard.CMS, CryptoStandard.CADES }
  Enum containing the Cryptographic Standards. More...
 

Public Member Functions

  PdfSigner (PdfReader reader, Stream outputStream, StampingProperties properties)
  Creates a PdfSigner instance. More...
 
  PdfSigner (PdfReader reader, Stream outputStream, String path, StampingProperties stampingProperties, SignerProperties signerProperties)
  Creates a PdfSigner instance. More...
 
  PdfSigner (PdfReader reader, Stream outputStream, String path, StampingProperties properties)
  Creates a PdfSigner instance. More...
 
virtual DateTime  GetSignDate ()
  Gets the signature date. More...
 
virtual void  SetSignDate (DateTime signDate)
  Sets the signature date. More...
 
virtual PdfSignatureAppearance  GetSignatureAppearance ()
  Provides access to a signature appearance object. More...
 
virtual void  SetSignatureAppearance (SignatureFieldAppearance appearance)
  Sets the signature field layout element to customize the appearance of the signature. More...
 
virtual int  GetCertificationLevel ()
  Returns the document's certification level. More...
 
virtual void  SetCertificationLevel (int certificationLevel)
  Sets the document's certification level. More...
 
virtual void  SetCertificationLevel (AccessPermissions accessPermissions)
  Sets the document's certification level. More...
 
virtual String  GetFieldName ()
  Gets the field name. More...
 
virtual PdfSignature  GetSignatureDictionary ()
  Returns the user made signature dictionary. More...
 
virtual PdfSigner.ISignatureEvent  GetSignatureEvent ()
  Getter for property signatureEvent. More...
 
virtual void  SetSignatureEvent (PdfSigner.ISignatureEvent signatureEvent)
  Sets the signature event to allow modification of the signature dictionary. More...
 
virtual String  GetNewSigFieldName ()
  Gets a new signature field name that doesn't clash with any existing name. More...
 
virtual void  SetFieldName (String fieldName)
  Sets the name indicating the field to be signed. More...
 
virtual PdfDocument  GetDocument ()
  Gets the PdfDocument associated with this instance. More...
 
virtual int  GetPageNumber ()
  Provides the page number of the signature field which this signature appearance is associated with. More...
 
virtual PdfSigner  SetPageNumber (int pageNumber)
  Sets the page number of the signature field which this signature appearance is associated with. More...
 
virtual Rectangle  GetPageRect ()
  Provides the rectangle that represent the position and dimension of the signature field in the page. More...
 
virtual PdfSigner  SetPageRect (Rectangle pageRect)
  Sets the rectangle that represent the position and dimension of the signature field in the page. More...
 
virtual void  SetOriginalOutputStream (Stream originalOS)
  Setter for the OutputStream. More...
 
virtual PdfSigFieldLock  GetFieldLockDict ()
  Getter for the field lock dictionary. More...
 
virtual void  SetFieldLockDict (PdfSigFieldLock fieldLock)
  Setter for the field lock dictionary. More...
 
virtual String  GetSignatureCreator ()
  Returns the signature creator. More...
 
virtual PdfSigner  SetSignatureCreator (String signatureCreator)
  Sets the name of the application used to create the signature. More...
 
virtual String  GetContact ()
  Returns the signing contact. More...
 
virtual PdfSigner  SetContact (String contact)
  Sets the signing contact. More...
 
virtual String  GetReason ()
  Returns the signing reason. More...
 
virtual PdfSigner  SetReason (String reason)
  Sets the signing reason. More...
 
virtual String  GetLocation ()
  Returns the signing location. More...
 
virtual PdfSigner  SetLocation (String location)
  Sets the signing location. More...
 
virtual PdfSignatureFormField  GetSignatureField ()
  Gets the signature field to be signed. More...
 
virtual void  SignDetached (IExternalDigest externalDigest, IExternalSignature externalSignature, IX509Certificate[] chain, ICollection< ICrlClient > crlList, IOcspClient ocspClient, ITSAClient tsaClient, int estimatedSize, PdfSigner.CryptoStandard sigtype)
  Signs the document using the detached mode, CMS or CAdES equivalent. More...
 
virtual void  SignDetached (IExternalSignature externalSignature, IX509Certificate[] chain, ICollection< ICrlClient > crlList, IOcspClient ocspClient, ITSAClient tsaClient, int estimatedSize, PdfSigner.CryptoStandard sigtype)
  Signs the document using the detached mode, CMS or CAdES equivalent. More...
 
virtual void  SignDetached (IExternalDigest externalDigest, IExternalSignature externalSignature, IX509Certificate[] chain, ICollection< ICrlClient > crlList, IOcspClient ocspClient, ITSAClient tsaClient, int estimatedSize, PdfSigner.CryptoStandard sigtype, SignaturePolicyInfo signaturePolicy)
  Signs the document using the detached mode, CMS or CAdES equivalent. More...
 
virtual void  SignDetached (IExternalSignature externalSignature, IX509Certificate[] chain, ICollection< ICrlClient > crlList, IOcspClient ocspClient, ITSAClient tsaClient, int estimatedSize, PdfSigner.CryptoStandard sigtype, SignaturePolicyInfo signaturePolicy)
  Signs the document using the detached mode, CMS or CAdES equivalent. More...
 
virtual void  SignDetached (IExternalSignature externalSignature, IX509Certificate[] chain, ICollection< ICrlClient > crlList, IOcspClient ocspClient, ITSAClient tsaClient, int estimatedSize, PdfSigner.CryptoStandard sigtype, ISignaturePolicyIdentifier signaturePolicy)
  Signs the document using the detached mode, CMS or CAdES equivalent. More...
 
virtual void  SignDetached (IExternalDigest externalDigest, IExternalSignature externalSignature, IX509Certificate[] chain, ICollection< ICrlClient > crlList, IOcspClient ocspClient, ITSAClient tsaClient, int estimatedSize, PdfSigner.CryptoStandard sigtype, ISignaturePolicyIdentifier signaturePolicy)
  Signs the document using the detached mode, CMS or CAdES equivalent. More...
 
virtual void  SignExternalContainer (IExternalSignatureContainer externalSignatureContainer, int estimatedSize)
  Sign the document using an external container, usually a PKCS7. More...
 
virtual void  Timestamp (ITSAClient tsa, String signatureName)
  Signs a document with a PAdES-LTV Timestamp. More...
 

Static Public Member Functions

static void  SignDeferred (PdfDocument document, String fieldName, Stream outs, IExternalSignatureContainer externalSignatureContainer)
  Signs a PDF where space was already reserved. More...
 

Static Public Attributes

const int  NOT_CERTIFIED = 0
  Approval signature. More...
 
const int  CERTIFIED_NO_CHANGES_ALLOWED = 1
  Author signature, no changes allowed. More...
 
const int  CERTIFIED_FORM_FILLING = 2
  Author signature, form filling allowed. More...
 
const int  CERTIFIED_FORM_FILLING_AND_ANNOTATIONS = 3
  Author signature, form filling and annotations allowed. More...
 

Package Functions

virtual PdfDocument  InitDocument (PdfReader reader, PdfWriter writer, StampingProperties properties)
  Initialize new iText.Kernel.Pdf.PdfDocument instance by using provided parameters. More...
 
virtual void  SetDocument (PdfDocument document)
  Sets the PdfDocument. More...
 
virtual ICollection< byte[]>  ProcessCrl (IX509Certificate cert, ICollection< ICrlClient > crlList)
  Processes a CRL list. More...
 
virtual void  AddDeveloperExtension (PdfDeveloperExtension extension)
  Add developer extension to the current iText.Kernel.Pdf.PdfDocument. More...
 
virtual bool  IsPreClosed ()
  Checks if the document is in the process of closing. More...
 
virtual void  PreClose (IDictionary< PdfName, int?> exclusionSizes)
  This is the first method to be called when using external signatures. More...
 
virtual PdfSigFieldLock  PopulateExistingSignatureFormField (PdfAcroForm acroForm)
  Populates already existing signature form field in the acroForm object. More...
 
virtual PdfSigFieldLock  CreateNewSignatureFormField (PdfAcroForm acroForm, String name)
  Creates new signature form field and adds it to the acroForm object. More...
 
virtual Stream  GetRangeStream ()
  Gets the document bytes that are hashable when using external signatures. More...
 
virtual void  Close (PdfDictionary update)
  This is the last method to be called when using external signatures. More...
 
virtual IRandomAccessSource  GetUnderlyingSource ()
  Returns the underlying source. More...
 
virtual void  AddDocMDP (PdfSignature crypto)
  Adds keys to the signature dictionary that define the certification level and the permissions. More...
 
virtual void  AddFieldMDP (PdfSignature crypto, PdfSigFieldLock fieldLock)
  Adds keys to the signature dictionary that define the field permissions. More...
 
virtual bool  DocumentContainsCertificationOrApprovalSignatures ()
  Check if current document instance already contains certification or approval signatures. More...
 
virtual Rectangle  GetWidgetRectangle (PdfWidgetAnnotation widget)
  Get the rectangle associated to the provided widget. More...
 
virtual int  GetWidgetPageNumber (PdfWidgetAnnotation widget)
  Get the page number associated to the provided widget. More...
 
delegate byte[]  ISignatureDataProvider (PdfSigner.SignatureApplier applier)
 

Package Attributes

int  certificationLevel = NOT_CERTIFIED
  The certification level. More...
 
String  fieldName
  The name of the field. More...
 
FileStream  raf
  The file right before the signature is added (can be null). More...
 
byte[]  bout
  The bytes of the file right before the signature is added (if raf is null). More...
 
long[]  range
  Array containing the byte positions of the bytes that need to be hashed. More...
 
PdfDocument  document
  The PdfDocument. More...
 
PdfSignature  cryptoDictionary
  The crypto dictionary. More...
 
PdfSigner.ISignatureEvent  signatureEvent
  Holds value of property signatureEvent. More...
 
Stream  originalOS
  OutputStream for the bytes of the document. More...
 
MemoryStream  temporaryOS
  Outputstream that temporarily holds the output in memory. More...
 
FileInfo  tempFile
  Tempfile to hold the output temporarily. More...
 
IDictionary< PdfName, PdfLiteral exclusionLocations
  Name and content of keys that can only be added in the close() method. More...
 
bool  preClosed = false
  Indicates if the pdf document has already been pre-closed. More...
 
PdfSigFieldLock  fieldLock
  Signature field lock dictionary. More...
 
PdfSignatureAppearance  appearance
  The signature appearance. More...
 
DateTime  signDate = DateTimeUtil.GetCurrentTime()
  Holds value of property signDate. More...
 
bool  closed = false
  Boolean to check if this PdfSigner instance has been closed already or not. More...
 

Detailed Description

Takes care of the cryptographic options and appearances that form a signature.

Member Enumeration Documentation

◆ CryptoStandard

Enum containing the Cryptographic Standards.

Enum containing the Cryptographic Standards. Possible values are "CMS" and "CADES".

Enumerator
CMS 

Cryptographic Message Syntax.

CADES 

CMS Advanced Electronic Signatures.

Constructor & Destructor Documentation

◆ PdfSigner() [1/3]

iText.Signatures.PdfSigner.PdfSigner ( PdfReader  reader,
Stream  outputStream,
StampingProperties  properties 
)
inline

Creates a PdfSigner instance.

Creates a PdfSigner instance. Uses a System.IO.MemoryStream instead of a temporary file.

Parameters
reader PdfReader that reads the PDF file
outputStream OutputStream to write the signed PDF file
properties

iText.Kernel.Pdf.StampingProperties for the signing document. Note that encryption will be preserved regardless of what is set in properties.

◆ PdfSigner() [2/3]

iText.Signatures.PdfSigner.PdfSigner ( PdfReader  reader,
Stream  outputStream,
String  path,
StampingProperties  stampingProperties,
SignerProperties  signerProperties 
)
inline

Creates a PdfSigner instance.

Creates a PdfSigner instance. Uses a System.IO.MemoryStream instead of a temporary file.

Parameters
reader PdfReader that reads the PDF file
outputStream OutputStream to write the signed PDF file
path File to which the output is temporarily written
stampingProperties

iText.Kernel.Pdf.StampingProperties for the signing document. Note that encryption will be preserved regardless of what is set in properties.

Parameters
signerProperties

SignerProperties bundled properties to be used in signing operations.

◆ PdfSigner() [3/3]

iText.Signatures.PdfSigner.PdfSigner ( PdfReader  reader,
Stream  outputStream,
String  path,
StampingProperties  properties 
)
inline

Creates a PdfSigner instance.

Creates a PdfSigner instance. Uses a System.IO.MemoryStream instead of a temporary file.

Parameters
reader PdfReader that reads the PDF file
outputStream OutputStream to write the signed PDF file
path File to which the output is temporarily written
properties

iText.Kernel.Pdf.StampingProperties for the signing document. Note that encryption will be preserved regardless of what is set in properties.

Member Function Documentation

◆ AddDeveloperExtension()

virtual void iText.Signatures.PdfSigner.AddDeveloperExtension ( PdfDeveloperExtension  extension )
inlinepackagevirtual

Add developer extension to the current iText.Kernel.Pdf.PdfDocument.

Parameters
extension

iText.Kernel.Pdf.PdfDeveloperExtension to be added

◆ AddDocMDP()

virtual void iText.Signatures.PdfSigner.AddDocMDP ( PdfSignature  crypto )
inlinepackagevirtual

Adds keys to the signature dictionary that define the certification level and the permissions.

Adds keys to the signature dictionary that define the certification level and the permissions. This method is only used for Certifying signatures.

Parameters
crypto the signature dictionary

◆ AddFieldMDP()

virtual void iText.Signatures.PdfSigner.AddFieldMDP ( PdfSignature  crypto,
PdfSigFieldLock  fieldLock 
)
inlinepackagevirtual

Adds keys to the signature dictionary that define the field permissions.

Adds keys to the signature dictionary that define the field permissions. This method is only used for signatures that lock fields.

Parameters
crypto the signature dictionary
fieldLock the iText.Forms.PdfSigFieldLock instance specified the field lock to be set

◆ Close()

virtual void iText.Signatures.PdfSigner.Close ( PdfDictionary  update )
inlinepackagevirtual

This is the last method to be called when using external signatures.

This is the last method to be called when using external signatures. The general sequence is: preClose(), getDocumentBytes() and close().

update is a PdfDictionary that must have exactly the same keys as the ones provided in PreClose(System.Collections.Generic.IDictionary).

Parameters
update a PdfDictionary with the key/value that will fill the holes defined in PreClose(System.Collections.Generic.IDictionary)

◆ CreateNewSignatureFormField()

virtual PdfSigFieldLock iText.Signatures.PdfSigner.CreateNewSignatureFormField ( PdfAcroForm  acroForm,
String  name 
)
inlinepackagevirtual

Creates new signature form field and adds it to the acroForm object.

Creates new signature form field and adds it to the acroForm object. This method is called during the PreClose(System.Collections.Generic.IDictionary) method if the signature field doesn't exist.

Parameters
acroForm

iText.Forms.PdfAcroForm object in which new signature field will be added

Parameters
name the name of the field
Returns
signature field lock dictionary

◆ DocumentContainsCertificationOrApprovalSignatures()

virtual bool iText.Signatures.PdfSigner.DocumentContainsCertificationOrApprovalSignatures ( )
inlinepackagevirtual

Check if current document instance already contains certification or approval signatures.

Returns

true if document contains certification or approval signatures, false otherwise

◆ GetCertificationLevel()

virtual int iText.Signatures.PdfSigner.GetCertificationLevel ( )
inlinevirtual

Returns the document's certification level.

Returns the document's certification level. For possible values see SetCertificationLevel(int).

Returns
The certified status.

◆ GetContact()

virtual String iText.Signatures.PdfSigner.GetContact ( )
inlinevirtual

Returns the signing contact.

Returns
The signing contact.

◆ GetDocument()

virtual PdfDocument iText.Signatures.PdfSigner.GetDocument ( )
inlinevirtual

Gets the PdfDocument associated with this instance.

Returns
the PdfDocument associated with this instance

◆ GetFieldLockDict()

virtual PdfSigFieldLock iText.Signatures.PdfSigner.GetFieldLockDict ( )
inlinevirtual

Getter for the field lock dictionary.

Returns
Field lock dictionary.

◆ GetFieldName()

virtual String iText.Signatures.PdfSigner.GetFieldName ( )
inlinevirtual

Gets the field name.

Returns
the field name

◆ GetLocation()

virtual String iText.Signatures.PdfSigner.GetLocation ( )
inlinevirtual

Returns the signing location.

Returns
The signing location.

◆ GetNewSigFieldName()

virtual String iText.Signatures.PdfSigner.GetNewSigFieldName ( )
inlinevirtual

Gets a new signature field name that doesn't clash with any existing name.

Returns
A new signature field name.

◆ GetPageNumber()

virtual int iText.Signatures.PdfSigner.GetPageNumber ( )
inlinevirtual

Provides the page number of the signature field which this signature appearance is associated with.

Returns
The page number of the signature field which this signature appearance is associated with.

◆ GetPageRect()

virtual Rectangle iText.Signatures.PdfSigner.GetPageRect ( )
inlinevirtual

Provides the rectangle that represent the position and dimension of the signature field in the page.

Returns
the rectangle that represent the position and dimension of the signature field in the page

◆ GetRangeStream()

virtual Stream iText.Signatures.PdfSigner.GetRangeStream ( )
inlinepackagevirtual

Gets the document bytes that are hashable when using external signatures.

Gets the document bytes that are hashable when using external signatures. The general sequence is: PreClose(System.Collections.Generic.IDictionary) , GetRangeStream() and Close(iText.Kernel.Pdf.PdfDictionary).

Returns
The System.IO.Stream of bytes to be signed.

◆ GetReason()

virtual String iText.Signatures.PdfSigner.GetReason ( )
inlinevirtual

Returns the signing reason.

Returns
The signing reason.

◆ GetSignatureAppearance()

virtual PdfSignatureAppearance iText.Signatures.PdfSigner.GetSignatureAppearance ( )
inlinevirtual

Provides access to a signature appearance object.

Provides access to a signature appearance object. Use it to customize the appearance of the signature.

Be aware:

  • If you create new signature field (either use SetFieldName(System.String) with the name that doesn't exist in the document or don't specify it at all) then the signature is invisible by default.
  • If you sign already existing field, then the signature appearance object is modified to have all the properties (page num., rect etc.) consistent with the state of the field (if you customized the appearance object before the SetFieldName(System.String) call you'll have to do it again)
Returns

PdfSignatureAppearance object.

◆ GetSignatureCreator()

virtual String iText.Signatures.PdfSigner.GetSignatureCreator ( )
inlinevirtual

Returns the signature creator.

Returns
The signature creator.

◆ GetSignatureDictionary()

virtual PdfSignature iText.Signatures.PdfSigner.GetSignatureDictionary ( )
inlinevirtual

Returns the user made signature dictionary.

Returns the user made signature dictionary. This is the dictionary at the /V key of the signature field.

Returns
The user made signature dictionary.

◆ GetSignatureEvent()

virtual PdfSigner.ISignatureEvent iText.Signatures.PdfSigner.GetSignatureEvent ( )
inlinevirtual

Getter for property signatureEvent.

Returns
Value of property signatureEvent.

◆ GetSignatureField()

virtual PdfSignatureFormField iText.Signatures.PdfSigner.GetSignatureField ( )
inlinevirtual

Gets the signature field to be signed.

Gets the signature field to be signed. The field can already be presented in the document. If the field is not presented in the document, it will be created.

This field instance is expected to be used for setting appearance related properties such as iText.Forms.Fields.PdfSignatureFormField.SetReuseAppearance(bool) , iText.Forms.Fields.PdfSignatureFormField.SetBackgroundLayer(iText.Kernel.Pdf.Xobject.PdfFormXObject) and iText.Forms.Fields.PdfSignatureFormField.SetSignatureAppearanceLayer(iText.Kernel.Pdf.Xobject.PdfFormXObject) .

Returns
the iText.Forms.Fields.PdfSignatureFormField instance.

◆ GetSignDate()

virtual DateTime iText.Signatures.PdfSigner.GetSignDate ( )
inlinevirtual

Gets the signature date.

Returns
Calendar set to the signature date

◆ GetUnderlyingSource()

virtual IRandomAccessSource iText.Signatures.PdfSigner.GetUnderlyingSource ( )
inlinepackagevirtual

Returns the underlying source.

Returns
the underlying source

◆ GetWidgetPageNumber()

virtual int iText.Signatures.PdfSigner.GetWidgetPageNumber ( PdfWidgetAnnotation  widget )
inlinepackagevirtual

Get the page number associated to the provided widget.

Parameters
widget PdfWidgetAnnotation from which to extract the page number
Returns
page number

◆ GetWidgetRectangle()

virtual Rectangle iText.Signatures.PdfSigner.GetWidgetRectangle ( PdfWidgetAnnotation  widget )
inlinepackagevirtual

Get the rectangle associated to the provided widget.

Parameters
widget PdfWidgetAnnotation to extract the rectangle from
Returns
Rectangle

◆ InitDocument()

virtual PdfDocument iText.Signatures.PdfSigner.InitDocument ( PdfReader  reader,
PdfWriter  writer,
StampingProperties  properties 
)
inlinepackagevirtual

Initialize new iText.Kernel.Pdf.PdfDocument instance by using provided parameters.

Parameters
reader

iText.Kernel.Pdf.PdfReader to be used as a reader in the new document

Parameters
writer

iText.Kernel.Pdf.PdfWriter to be used as a writer in the new document

Parameters
properties

iText.Kernel.Pdf.StampingProperties to be provided in the new document

Returns
new iText.Kernel.Pdf.PdfDocument instance

◆ IsPreClosed()

virtual bool iText.Signatures.PdfSigner.IsPreClosed ( )
inlinepackagevirtual

Checks if the document is in the process of closing.

Returns
true if the document is in the process of closing, false otherwise

◆ PopulateExistingSignatureFormField()

virtual PdfSigFieldLock iText.Signatures.PdfSigner.PopulateExistingSignatureFormField ( PdfAcroForm  acroForm )
inlinepackagevirtual

Populates already existing signature form field in the acroForm object.

Populates already existing signature form field in the acroForm object. This method is called during the PreClose(System.Collections.Generic.IDictionary) method if the signature field already exists.

Parameters
acroForm

iText.Forms.PdfAcroForm object in which the signature field will be populated

Returns
signature field lock dictionary

◆ PreClose()

virtual void iText.Signatures.PdfSigner.PreClose ( IDictionary< PdfName, int?>  exclusionSizes )
inlinepackagevirtual

This is the first method to be called when using external signatures.

This is the first method to be called when using external signatures. The general sequence is: preClose(), getDocumentBytes() and close().

exclusionSizes must contain at least the PdfName.CONTENTS key with the size that it will take in the document. Note that due to the hex string coding this size should be byte_size*2+2.

Parameters
exclusionSizes Map with names and sizes to be excluded in the signature calculation. The key is a PdfName and the value an Integer. At least the /Contents must be present

◆ ProcessCrl()

virtual ICollection iText.Signatures.PdfSigner.ProcessCrl ( IX509Certificate  cert,
ICollection< ICrlClient crlList 
)
inlinepackagevirtual

Processes a CRL list.

Parameters
cert a Certificate if one of the CrlList implementations needs to retrieve the CRL URL from it.
crlList a list of CrlClient implementations
Returns
a collection of CRL bytes that can be embedded in a PDF

◆ SetCertificationLevel() [1/2]

virtual void iText.Signatures.PdfSigner.SetCertificationLevel ( AccessPermissions  accessPermissions )
inlinevirtual

Sets the document's certification level.

Sets the document's certification level. This method overrides the value set by SetCertificationLevel(int).

Parameters
accessPermissions

AccessPermissions enum which specifies which certification level shall be used

◆ SetCertificationLevel() [2/2]

virtual void iText.Signatures.PdfSigner.SetCertificationLevel ( int  certificationLevel )
inlinevirtual

Sets the document's certification level.

Sets the document's certification level. This method overrides the value set by SetCertificationLevel(AccessPermissions).

Parameters
certificationLevel a new certification level for a document. Possible values are:

◆ SetContact()

virtual PdfSigner iText.Signatures.PdfSigner.SetContact ( String  contact )
inlinevirtual

Sets the signing contact.

Parameters
contact A new signing contact.
Returns
this instance to support fluent interface.

◆ SetDocument()

virtual void iText.Signatures.PdfSigner.SetDocument ( PdfDocument  document )
inlinepackagevirtual

Sets the PdfDocument.

Parameters
document The PdfDocument

◆ SetFieldLockDict()

virtual void iText.Signatures.PdfSigner.SetFieldLockDict ( PdfSigFieldLock  fieldLock )
inlinevirtual

Setter for the field lock dictionary.

Setter for the field lock dictionary.

Be aware: if a signature is created on an existing signature field, then its /Lock dictionary takes the precedence (if it exists).

Parameters
fieldLock Field lock dictionary

◆ SetFieldName()

virtual void iText.Signatures.PdfSigner.SetFieldName ( String  fieldName )
inlinevirtual

Sets the name indicating the field to be signed.

Sets the name indicating the field to be signed. The field can already be presented in the document but shall not be signed. If the field is not presented in the document, it will be created.

Parameters
fieldName The name indicating the field to be signed.

◆ SetLocation()

virtual PdfSigner iText.Signatures.PdfSigner.SetLocation ( String  location )
inlinevirtual

Sets the signing location.

Parameters
location A new signing location.
Returns
this instance to support fluent interface.

◆ SetOriginalOutputStream()

virtual void iText.Signatures.PdfSigner.SetOriginalOutputStream ( Stream  originalOS )
inlinevirtual

Setter for the OutputStream.

Parameters
originalOS OutputStream for the bytes of the document

◆ SetPageNumber()

virtual PdfSigner iText.Signatures.PdfSigner.SetPageNumber ( int  pageNumber )
inlinevirtual

Sets the page number of the signature field which this signature appearance is associated with.

Sets the page number of the signature field which this signature appearance is associated with. Implicitly calls SetPageRect(iText.Kernel.Geom.Rectangle) which considers page number to process the rectangle correctly.

Parameters
pageNumber The page number of the signature field which this signature appearance is associated with.
Returns
this instance to support fluent interface.

◆ SetPageRect()

virtual PdfSigner iText.Signatures.PdfSigner.SetPageRect ( Rectangle  pageRect )
inlinevirtual

Sets the rectangle that represent the position and dimension of the signature field in the page.

Parameters
pageRect The rectangle that represents the position and dimension of the signature field in the page.
Returns
this instance to support fluent interface.

◆ SetReason()

virtual PdfSigner iText.Signatures.PdfSigner.SetReason ( String  reason )
inlinevirtual

Sets the signing reason.

Parameters
reason A new signing reason.
Returns
this instance to support fluent interface.

◆ SetSignatureAppearance()

virtual void iText.Signatures.PdfSigner.SetSignatureAppearance ( SignatureFieldAppearance  appearance )
inlinevirtual

Sets the signature field layout element to customize the appearance of the signature.

Sets the signature field layout element to customize the appearance of the signature. Signer's sign date will be set.

Parameters
appearance the iText.Forms.Form.Element.SignatureFieldAppearance layout element.

◆ SetSignatureCreator()

virtual PdfSigner iText.Signatures.PdfSigner.SetSignatureCreator ( String  signatureCreator )
inlinevirtual

Sets the name of the application used to create the signature.

Parameters
signatureCreator A new name of the application signing a document.
Returns
this instance to support fluent interface.

◆ SetSignatureEvent()

virtual void iText.Signatures.PdfSigner.SetSignatureEvent ( PdfSigner.ISignatureEvent  signatureEvent )
inlinevirtual

Sets the signature event to allow modification of the signature dictionary.

Parameters
signatureEvent the signature event

◆ SetSignDate()

virtual void iText.Signatures.PdfSigner.SetSignDate ( DateTime  signDate )
inlinevirtual

Sets the signature date.

Parameters
signDate the signature date

◆ SignDeferred()

static void iText.Signatures.PdfSigner.SignDeferred ( PdfDocument  document,
String  fieldName,
Stream  outs,
IExternalSignatureContainer  externalSignatureContainer 
)
inlinestatic

Signs a PDF where space was already reserved.

Parameters
document the original PDF
fieldName the field to sign. It must be the last field
outs the output PDF
externalSignatureContainer the signature container doing the actual signing. Only the method ExternalSignatureContainer.sign is used

◆ SignDetached() [1/6]

virtual void iText.Signatures.PdfSigner.SignDetached ( IExternalDigest  externalDigest,
IExternalSignature  externalSignature,
IX509Certificate[]  chain,
ICollection< ICrlClient crlList,
IOcspClient  ocspClient,
ITSAClient  tsaClient,
int  estimatedSize,
PdfSigner.CryptoStandard  sigtype 
)
inlinevirtual

Signs the document using the detached mode, CMS or CAdES equivalent.

Signs the document using the detached mode, CMS or CAdES equivalent.

NOTE: This method closes the underlying pdf document. This means, that current instance of PdfSigner cannot be used after this method call.

Parameters
externalSignature the interface providing the actual signing
chain the certificate chain
crlList the CRL list
ocspClient the OCSP client
tsaClient the Timestamp client
externalDigest an implementation that provides the digest
estimatedSize the reserved size for the signature. It will be estimated if 0
sigtype Either Signature.CMS or Signature.CADES

◆ SignDetached() [2/6]

virtual void iText.Signatures.PdfSigner.SignDetached ( IExternalDigest  externalDigest,
IExternalSignature  externalSignature,
IX509Certificate[]  chain,
ICollection< ICrlClient crlList,
IOcspClient  ocspClient,
ITSAClient  tsaClient,
int  estimatedSize,
PdfSigner.CryptoStandard  sigtype,
ISignaturePolicyIdentifier  signaturePolicy 
)
inlinevirtual

Signs the document using the detached mode, CMS or CAdES equivalent.

Signs the document using the detached mode, CMS or CAdES equivalent.

NOTE: This method closes the underlying pdf document. This means, that current instance of PdfSigner cannot be used after this method call.

Parameters
externalSignature the interface providing the actual signing
chain the certificate chain
crlList the CRL list
ocspClient the OCSP client
tsaClient the Timestamp client
externalDigest an implementation that provides the digest
estimatedSize the reserved size for the signature. It will be estimated if 0
sigtype Either Signature.CMS or Signature.CADES
signaturePolicy the signature policy (for EPES signatures)

◆ SignDetached() [3/6]

virtual void iText.Signatures.PdfSigner.SignDetached ( IExternalDigest  externalDigest,
IExternalSignature  externalSignature,
IX509Certificate[]  chain,
ICollection< ICrlClient crlList,
IOcspClient  ocspClient,
ITSAClient  tsaClient,
int  estimatedSize,
PdfSigner.CryptoStandard  sigtype,
SignaturePolicyInfo  signaturePolicy 
)
inlinevirtual

Signs the document using the detached mode, CMS or CAdES equivalent.

Signs the document using the detached mode, CMS or CAdES equivalent.

NOTE: This method closes the underlying pdf document. This means, that current instance of PdfSigner cannot be used after this method call.

Parameters
externalSignature the interface providing the actual signing
chain the certificate chain
crlList the CRL list
ocspClient the OCSP client
tsaClient the Timestamp client
externalDigest an implementation that provides the digest
estimatedSize the reserved size for the signature. It will be estimated if 0
sigtype Either Signature.CMS or Signature.CADES
signaturePolicy the signature policy (for EPES signatures)

◆ SignDetached() [4/6]

virtual void iText.Signatures.PdfSigner.SignDetached ( IExternalSignature  externalSignature,
IX509Certificate[]  chain,
ICollection< ICrlClient crlList,
IOcspClient  ocspClient,
ITSAClient  tsaClient,
int  estimatedSize,
PdfSigner.CryptoStandard  sigtype 
)
inlinevirtual

Signs the document using the detached mode, CMS or CAdES equivalent.

Signs the document using the detached mode, CMS or CAdES equivalent.

NOTE: This method closes the underlying pdf document. This means, that current instance of PdfSigner cannot be used after this method call.

Parameters
externalSignature the interface providing the actual signing
chain the certificate chain
crlList the CRL list
ocspClient the OCSP client
tsaClient the Timestamp client
estimatedSize the reserved size for the signature. It will be estimated if 0
sigtype Either Signature.CMS or Signature.CADES

◆ SignDetached() [5/6]

virtual void iText.Signatures.PdfSigner.SignDetached ( IExternalSignature  externalSignature,
IX509Certificate[]  chain,
ICollection< ICrlClient crlList,
IOcspClient  ocspClient,
ITSAClient  tsaClient,
int  estimatedSize,
PdfSigner.CryptoStandard  sigtype,
ISignaturePolicyIdentifier  signaturePolicy 
)
inlinevirtual

Signs the document using the detached mode, CMS or CAdES equivalent.

Signs the document using the detached mode, CMS or CAdES equivalent.

NOTE: This method closes the underlying pdf document. This means, that current instance of PdfSigner cannot be used after this method call.

Parameters
externalSignature the interface providing the actual signing
chain the certificate chain
crlList the CRL list
ocspClient the OCSP client
tsaClient the Timestamp client
estimatedSize the reserved size for the signature. It will be estimated if 0
sigtype Either Signature.CMS or Signature.CADES
signaturePolicy the signature policy (for EPES signatures)

◆ SignDetached() [6/6]

virtual void iText.Signatures.PdfSigner.SignDetached ( IExternalSignature  externalSignature,
IX509Certificate[]  chain,
ICollection< ICrlClient crlList,
IOcspClient  ocspClient,
ITSAClient  tsaClient,
int  estimatedSize,
PdfSigner.CryptoStandard  sigtype,
SignaturePolicyInfo  signaturePolicy 
)
inlinevirtual

Signs the document using the detached mode, CMS or CAdES equivalent.

Signs the document using the detached mode, CMS or CAdES equivalent.

NOTE: This method closes the underlying pdf document. This means, that current instance of PdfSigner cannot be used after this method call.

Parameters
externalSignature the interface providing the actual signing
chain the certificate chain
crlList the CRL list
ocspClient the OCSP client
tsaClient the Timestamp client
estimatedSize the reserved size for the signature. It will be estimated if 0
sigtype Either Signature.CMS or Signature.CADES
signaturePolicy the signature policy (for EPES signatures)

◆ SignExternalContainer()

virtual void iText.Signatures.PdfSigner.SignExternalContainer ( IExternalSignatureContainer  externalSignatureContainer,
int  estimatedSize 
)
inlinevirtual

Sign the document using an external container, usually a PKCS7.

Sign the document using an external container, usually a PKCS7. The signature is fully composed externally, iText will just put the container inside the document.

NOTE: This method closes the underlying pdf document. This means, that current instance of PdfSigner cannot be used after this method call.

Parameters
externalSignatureContainer the interface providing the actual signing
estimatedSize the reserved size for the signature

◆ Timestamp()

virtual void iText.Signatures.PdfSigner.Timestamp ( ITSAClient  tsa,
String  signatureName 
)
inlinevirtual

Signs a document with a PAdES-LTV Timestamp.

Signs a document with a PAdES-LTV Timestamp. The document is closed at the end.

NOTE: This method closes the underlying pdf document. This means, that current instance of PdfSigner cannot be used after this method call.

Parameters
tsa the timestamp generator
signatureName the signature name or null to have a name generated automatically

Member Data Documentation

◆ appearance

PdfSignatureAppearance iText.Signatures.PdfSigner.appearance
package

The signature appearance.

◆ bout

byte [] iText.Signatures.PdfSigner.bout
package

The bytes of the file right before the signature is added (if raf is null).

◆ certificationLevel

int iText.Signatures.PdfSigner.certificationLevel = NOT_CERTIFIED
package

The certification level.

◆ CERTIFIED_FORM_FILLING

const int iText.Signatures.PdfSigner.CERTIFIED_FORM_FILLING = 2
static

Author signature, form filling allowed.

◆ CERTIFIED_FORM_FILLING_AND_ANNOTATIONS

const int iText.Signatures.PdfSigner.CERTIFIED_FORM_FILLING_AND_ANNOTATIONS = 3
static

Author signature, form filling and annotations allowed.

◆ CERTIFIED_NO_CHANGES_ALLOWED

const int iText.Signatures.PdfSigner.CERTIFIED_NO_CHANGES_ALLOWED = 1
static

Author signature, no changes allowed.

◆ closed

bool iText.Signatures.PdfSigner.closed = false
package

Boolean to check if this PdfSigner instance has been closed already or not.

◆ cryptoDictionary

PdfSignature iText.Signatures.PdfSigner.cryptoDictionary
package

The crypto dictionary.

◆ document

PdfDocument iText.Signatures.PdfSigner.document
package

The PdfDocument.

◆ exclusionLocations

IDictionary<PdfName, PdfLiteral> iText.Signatures.PdfSigner.exclusionLocations
package

Name and content of keys that can only be added in the close() method.

◆ fieldLock

PdfSigFieldLock iText.Signatures.PdfSigner.fieldLock
package

Signature field lock dictionary.

◆ fieldName

String iText.Signatures.PdfSigner.fieldName
package

The name of the field.

◆ NOT_CERTIFIED

const int iText.Signatures.PdfSigner.NOT_CERTIFIED = 0
static

Approval signature.

◆ originalOS

Stream iText.Signatures.PdfSigner.originalOS
package

OutputStream for the bytes of the document.

◆ preClosed

bool iText.Signatures.PdfSigner.preClosed = false
package

Indicates if the pdf document has already been pre-closed.

◆ raf

FileStream iText.Signatures.PdfSigner.raf
package

The file right before the signature is added (can be null).

◆ range

long [] iText.Signatures.PdfSigner.range
package

Array containing the byte positions of the bytes that need to be hashed.

◆ signatureEvent

PdfSigner.ISignatureEvent iText.Signatures.PdfSigner.signatureEvent
package

Holds value of property signatureEvent.

◆ signDate

DateTime iText.Signatures.PdfSigner.signDate = DateTimeUtil.GetCurrentTime()
package

Holds value of property signDate.

◆ tempFile

FileInfo iText.Signatures.PdfSigner.tempFile
package

Tempfile to hold the output temporarily.

◆ temporaryOS

MemoryStream iText.Signatures.PdfSigner.temporaryOS
package

Outputstream that temporarily holds the output in memory.