iText 8.0.5 API
iText.Signatures.PdfTwoPhaseSigner Class Reference

Class that prepares document and adds the signature to it while performing signing operation in two steps (see PadesTwoPhaseSigningHelper for more info). More...

Public Member Functions

  PdfTwoPhaseSigner (PdfReader reader, Stream outputStream)
  Creates new PdfTwoPhaseSigner instance. More...
 
virtual byte[]  PrepareDocumentForSignature (SignerProperties signerProperties, String digestAlgorithm, PdfName filter, PdfName subFilter, int estimatedSize, bool includeDate)
  Prepares document for signing, calculates the document digest to sign and closes the document. More...
 
virtual iText.Signatures.PdfTwoPhaseSigner  SetExternalDigest (IExternalDigest externalDigest)
  Use the external digest to inject specific digest implementations More...
 
virtual iText.Signatures.PdfTwoPhaseSigner  SetStampingProperties (StampingProperties stampingProperties)
  Set stamping properties to be used during main signing operation. More...
 

Static Public Member Functions

static void  AddSignatureToPreparedDocument (PdfDocument document, String fieldName, Stream outs, CMSContainer cmsContainer)
  Adds an existing signature to a PDF where space was already reserved. More...
 
static void  AddSignatureToPreparedDocument (PdfDocument document, String fieldName, Stream outs, byte[] signedContent)
  Adds an existing signature to a PDF where space was already reserved. More...
 

Detailed Description

Class that prepares document and adds the signature to it while performing signing operation in two steps (see PadesTwoPhaseSigningHelper for more info).

Class that prepares document and adds the signature to it while performing signing operation in two steps (see PadesTwoPhaseSigningHelper for more info).

Firstly, this class allows to prepare the document for signing and calculate the document digest to sign. Secondly, it adds an existing signature to a PDF where space was already reserved.

Constructor & Destructor Documentation

◆ PdfTwoPhaseSigner()

iText.Signatures.PdfTwoPhaseSigner.PdfTwoPhaseSigner ( PdfReader  reader,
Stream  outputStream 
)
inline

Creates new PdfTwoPhaseSigner instance.

Parameters
reader

iText.Kernel.Pdf.PdfReader instance to read the original PDF file

Parameters
outputStream

System.IO.Stream output stream to write the resulting PDF file into

Member Function Documentation

◆ AddSignatureToPreparedDocument() [1/2]

static void iText.Signatures.PdfTwoPhaseSigner.AddSignatureToPreparedDocument ( PdfDocument  document,
String  fieldName,
Stream  outs,
byte[]  signedContent 
)
inlinestatic

Adds an existing signature to 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
signedContent the bytes for the signed data

◆ AddSignatureToPreparedDocument() [2/2]

static void iText.Signatures.PdfTwoPhaseSigner.AddSignatureToPreparedDocument ( PdfDocument  document,
String  fieldName,
Stream  outs,
CMSContainer  cmsContainer 
)
inlinestatic

Adds an existing signature to 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
cmsContainer the finalized CMS container

◆ PrepareDocumentForSignature()

virtual byte [] iText.Signatures.PdfTwoPhaseSigner.PrepareDocumentForSignature ( SignerProperties  signerProperties,
String  digestAlgorithm,
PdfName  filter,
PdfName  subFilter,
int  estimatedSize,
bool  includeDate 
)
inlinevirtual

Prepares document for signing, calculates the document digest to sign and closes the document.

Parameters
signerProperties

SignerProperties properties to be used for main signing operation

Parameters
digestAlgorithm the algorithm to generate the digest with
filter PdfName of the signature handler to use when validating this signature
subFilter PdfName that describes the encoding of the signature
estimatedSize the estimated size of the signature, this is the size of the space reserved for the Cryptographic Message Container
includeDate specifies if the signing date should be set to the signature dictionary
Returns
the message digest of the prepared document.

◆ SetExternalDigest()

virtual iText.Signatures.PdfTwoPhaseSigner iText.Signatures.PdfTwoPhaseSigner.SetExternalDigest ( IExternalDigest  externalDigest )
inlinevirtual

Use the external digest to inject specific digest implementations

Parameters
externalDigest the IExternalDigest instance to use to generate Digests
Returns
same instance of PdfTwoPhaseSigner

◆ SetStampingProperties()

virtual iText.Signatures.PdfTwoPhaseSigner iText.Signatures.PdfTwoPhaseSigner.SetStampingProperties ( StampingProperties  stampingProperties )
inlinevirtual

Set stamping properties to be used during main signing operation.

Set stamping properties to be used during main signing operation.

If none is set, stamping properties with append mode enabled will be used

Parameters
stampingProperties

iText.Kernel.Pdf.StampingProperties instance to be used during main signing operation

Returns
same instance of PdfTwoPhaseSigner