Table of Contents

Class PdfSigner

Namespace
iText.Signatures
Assembly
itext.sign.dll

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

public class PdfSigner
Inheritance
PdfSigner
Inherited Members

Constructors

PdfSigner(PdfReader, Stream, string, StampingProperties)

Creates a PdfSigner instance.

public PdfSigner(PdfReader reader, Stream outputStream, string path, StampingProperties properties)

Parameters

reader PdfReader

PdfReader that reads the PDF file

outputStream Stream

OutputStream to write the signed PDF file

path string

File to which the output is temporarily written

properties StampingProperties

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

Remarks

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

PdfSigner(PdfReader, Stream, string, StampingProperties, SignerProperties)

Creates a PdfSigner instance.

public PdfSigner(PdfReader reader, Stream outputStream, string path, StampingProperties stampingProperties, SignerProperties signerProperties)

Parameters

reader PdfReader

PdfReader that reads the PDF file

outputStream Stream

OutputStream to write the signed PDF file

path string

File to which the output is temporarily written

stampingProperties StampingProperties

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

signerProperties SignerProperties

SignerProperties bundled properties to be used in signing operations.

Remarks

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

PdfSigner(PdfReader, Stream, StampingProperties)

Creates a PdfSigner instance.

public PdfSigner(PdfReader reader, Stream outputStream, StampingProperties properties)

Parameters

reader PdfReader

PdfReader that reads the PDF file

outputStream Stream

OutputStream to write the signed PDF file

properties StampingProperties

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

Remarks

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

Fields

CERTIFIED_FORM_FILLING

Author signature, form filling allowed.

public const int CERTIFIED_FORM_FILLING = 2

Field Value

int

CERTIFIED_FORM_FILLING_AND_ANNOTATIONS

Author signature, form filling and annotations allowed.

public const int CERTIFIED_FORM_FILLING_AND_ANNOTATIONS = 3

Field Value

int

CERTIFIED_NO_CHANGES_ALLOWED

Author signature, no changes allowed.

public const int CERTIFIED_NO_CHANGES_ALLOWED = 1

Field Value

int

NOT_CERTIFIED

Approval signature.

public const int NOT_CERTIFIED = 0

Field Value

int

appearance

The signature appearance.

protected PdfSignatureAppearance appearance

Field Value

PdfSignatureAppearance

bout

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

protected byte[] bout

Field Value

byte[]

certificationLevel

The certification level.

protected int certificationLevel

Field Value

int

closed

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

protected bool closed

Field Value

bool

cryptoDictionary

The crypto dictionary.

protected PdfSignature cryptoDictionary

Field Value

PdfSignature

document

The PdfDocument.

protected PdfDocument document

Field Value

PdfDocument

exclusionLocations

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

protected IDictionary<PdfName, PdfLiteral> exclusionLocations

Field Value

IDictionary<PdfName, PdfLiteral>

fieldLock

Signature field lock dictionary.

protected PdfSigFieldLock fieldLock

Field Value

PdfSigFieldLock

fieldName

The name of the field.

protected string fieldName

Field Value

string

originalOS

OutputStream for the bytes of the document.

protected Stream originalOS

Field Value

Stream

preClosed

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

protected bool preClosed

Field Value

bool

raf

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

protected FileStream raf

Field Value

FileStream

range

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

protected long[] range

Field Value

long[]

signDate

Holds value of property signDate.

protected DateTime signDate

Field Value

DateTime

signatureEvent

Holds value of property signatureEvent.

protected PdfSigner.ISignatureEvent signatureEvent

Field Value

PdfSigner.ISignatureEvent

tempFile

Tempfile to hold the output temporarily.

protected FileInfo tempFile

Field Value

FileInfo

temporaryOS

Outputstream that temporarily holds the output in memory.

protected MemoryStream temporaryOS

Field Value

MemoryStream

Methods

AddDeveloperExtension(PdfDeveloperExtension)

Add developer extension to the current PdfDocument.

protected virtual void AddDeveloperExtension(PdfDeveloperExtension extension)

Parameters

extension PdfDeveloperExtension

PdfDeveloperExtension to be added

AddDocMDP(PdfSignature)

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

protected virtual void AddDocMDP(PdfSignature crypto)

Parameters

crypto PdfSignature

the signature dictionary

Remarks

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

AddFieldMDP(PdfSignature, PdfSigFieldLock)

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

protected virtual void AddFieldMDP(PdfSignature crypto, PdfSigFieldLock fieldLock)

Parameters

crypto PdfSignature

the signature dictionary

fieldLock PdfSigFieldLock

the PdfSigFieldLock instance specified the field lock to be set

Remarks

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

Close(PdfDictionary)

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

protected virtual void Close(PdfDictionary update)

Parameters

update PdfDictionary

a PdfDictionary with the key/value that will fill the holes defined in

Remarks

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 .

CreateNewSignatureFormField(PdfAcroForm, string)

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

protected virtual PdfSigFieldLock CreateNewSignatureFormField(PdfAcroForm acroForm, string name)

Parameters

acroForm PdfAcroForm

PdfAcroForm object in which new signature field will be added

name string

the name of the field

Returns

PdfSigFieldLock

signature field lock dictionary

Remarks

Creates new signature form field and adds it to the acroForm object. This method is called during the method if the signature field doesn't exist.

DocumentContainsCertificationOrApprovalSignatures()

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

protected virtual bool DocumentContainsCertificationOrApprovalSignatures()

Returns

bool

true if document contains certification or approval signatures, false otherwise

GetCertificationLevel()

Returns the document's certification level.

public virtual int GetCertificationLevel()

Returns

int

The certified status.

Remarks

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

GetContact()

Returns the signing contact.

public virtual string GetContact()

Returns

string

The signing contact.

GetDocument()

Gets the PdfDocument associated with this instance.

public virtual PdfDocument GetDocument()

Returns

PdfDocument

the PdfDocument associated with this instance

GetFieldLockDict()

Getter for the field lock dictionary.

public virtual PdfSigFieldLock GetFieldLockDict()

Returns

PdfSigFieldLock

Field lock dictionary.

GetFieldName()

Gets the field name.

public virtual string GetFieldName()

Returns

string

the field name

GetLocation()

Returns the signing location.

public virtual string GetLocation()

Returns

string

The signing location.

GetNewSigFieldName()

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

public virtual string GetNewSigFieldName()

Returns

string

A new signature field name.

GetPageNumber()

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

public virtual int GetPageNumber()

Returns

int

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

GetPageRect()

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

public virtual Rectangle GetPageRect()

Returns

Rectangle

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

GetRangeStream()

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

protected virtual Stream GetRangeStream()

Returns

Stream

The Stream of bytes to be signed.

Remarks

Gets the document bytes that are hashable when using external signatures. The general sequence is: , GetRangeStream() and Close(PdfDictionary).

GetReason()

Returns the signing reason.

public virtual string GetReason()

Returns

string

The signing reason.

GetSignDate()

Gets the signature date.

public virtual DateTime GetSignDate()

Returns

DateTime

Calendar set to the signature date

GetSignatureAppearance()

Provides access to a signature appearance object.

[Obsolete]
public virtual PdfSignatureAppearance GetSignatureAppearance()

Returns

PdfSignatureAppearance

PdfSignatureAppearance object.

Remarks

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(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(string) call you'll have to do it again)

GetSignatureCreator()

Returns the signature creator.

public virtual string GetSignatureCreator()

Returns

string

The signature creator.

GetSignatureDictionary()

Returns the user made signature dictionary.

public virtual PdfSignature GetSignatureDictionary()

Returns

PdfSignature

The user made signature dictionary.

Remarks

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

GetSignatureEvent()

Getter for property signatureEvent.

public virtual PdfSigner.ISignatureEvent GetSignatureEvent()

Returns

PdfSigner.ISignatureEvent

Value of property signatureEvent.

GetSignatureField()

Gets the signature field to be signed.

public virtual PdfSignatureFormField GetSignatureField()

Returns

PdfSignatureFormField

the PdfSignatureFormField instance.

Remarks

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 SetReuseAppearance(bool) , SetBackgroundLayer(PdfFormXObject) and SetSignatureAppearanceLayer(PdfFormXObject).

GetUnderlyingSource()

Returns the underlying source.

protected virtual IRandomAccessSource GetUnderlyingSource()

Returns

IRandomAccessSource

the underlying source

GetWidgetPageNumber(PdfWidgetAnnotation)

Get the page number associated to the provided widget.

protected virtual int GetWidgetPageNumber(PdfWidgetAnnotation widget)

Parameters

widget PdfWidgetAnnotation

PdfWidgetAnnotation from which to extract the page number

Returns

int

page number

GetWidgetRectangle(PdfWidgetAnnotation)

Get the rectangle associated to the provided widget.

protected virtual Rectangle GetWidgetRectangle(PdfWidgetAnnotation widget)

Parameters

widget PdfWidgetAnnotation

PdfWidgetAnnotation to extract the rectangle from

Returns

Rectangle

Rectangle

InitDocument(PdfReader, PdfWriter, StampingProperties)

Initialize new PdfDocument instance by using provided parameters.

protected virtual PdfDocument InitDocument(PdfReader reader, PdfWriter writer, StampingProperties properties)

Parameters

reader PdfReader

PdfReader to be used as a reader in the new document

writer PdfWriter

PdfWriter to be used as a writer in the new document

properties StampingProperties

StampingProperties to be provided in the new document

Returns

PdfDocument

new PdfDocument instance

IsPreClosed()

Checks if the document is in the process of closing.

protected virtual bool IsPreClosed()

Returns

bool

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

PopulateExistingSignatureFormField(PdfAcroForm)

Populates already existing signature form field in the acroForm object.

protected virtual PdfSigFieldLock PopulateExistingSignatureFormField(PdfAcroForm acroForm)

Parameters

acroForm PdfAcroForm

PdfAcroForm object in which the signature field will be populated

Returns

PdfSigFieldLock

signature field lock dictionary

Remarks

Populates already existing signature form field in the acroForm object. This method is called during the method if the signature field already exists.

PreClose(IDictionary<PdfName, int?>)

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

protected virtual void PreClose(IDictionary<PdfName, int?> exclusionSizes)

Parameters

exclusionSizes IDictionary<PdfName, int?>

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

Remarks

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.

ProcessCrl(IX509Certificate, ICollection<ICrlClient>)

Processes a CRL list.

protected virtual ICollection<byte[]> ProcessCrl(IX509Certificate cert, ICollection<ICrlClient> crlList)

Parameters

cert IX509Certificate

a Certificate if one of the CrlList implementations needs to retrieve the CRL URL from it.

crlList ICollection<ICrlClient>

a list of CrlClient implementations

Returns

ICollection<byte[]>

a collection of CRL bytes that can be embedded in a PDF

SetCertificationLevel(int)

Sets the document's certification level.

public virtual void SetCertificationLevel(int certificationLevel)

Parameters

certificationLevel int

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

Remarks

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

SetCertificationLevel(AccessPermissions)

Sets the document's certification level.

public virtual void SetCertificationLevel(AccessPermissions accessPermissions)

Parameters

accessPermissions AccessPermissions

AccessPermissions enum which specifies which certification level shall be used

Remarks

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

SetContact(string)

Sets the signing contact.

public virtual PdfSigner SetContact(string contact)

Parameters

contact string

A new signing contact.

Returns

PdfSigner

this instance to support fluent interface.

SetDocument(PdfDocument)

Sets the PdfDocument.

protected virtual void SetDocument(PdfDocument document)

Parameters

document PdfDocument

The PdfDocument

SetFieldLockDict(PdfSigFieldLock)

Setter for the field lock dictionary.

public virtual void SetFieldLockDict(PdfSigFieldLock fieldLock)

Parameters

fieldLock PdfSigFieldLock

Field lock dictionary

Remarks

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).

SetFieldName(string)

Sets the name indicating the field to be signed.

public virtual void SetFieldName(string fieldName)

Parameters

fieldName string

The name indicating the field to be signed.

Remarks

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.

SetLocation(string)

Sets the signing location.

public virtual PdfSigner SetLocation(string location)

Parameters

location string

A new signing location.

Returns

PdfSigner

this instance to support fluent interface.

SetOriginalOutputStream(Stream)

Setter for the OutputStream.

public virtual void SetOriginalOutputStream(Stream originalOS)

Parameters

originalOS Stream

OutputStream for the bytes of the document

SetPageNumber(int)

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

public virtual PdfSigner SetPageNumber(int pageNumber)

Parameters

pageNumber int

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

Returns

PdfSigner

this instance to support fluent interface.

Remarks

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

SetPageRect(Rectangle)

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

public virtual PdfSigner SetPageRect(Rectangle pageRect)

Parameters

pageRect Rectangle

The rectangle that represents the position and dimension of the signature field in the page.

Returns

PdfSigner

this instance to support fluent interface.

SetReason(string)

Sets the signing reason.

public virtual PdfSigner SetReason(string reason)

Parameters

reason string

A new signing reason.

Returns

PdfSigner

this instance to support fluent interface.

SetSignDate(DateTime)

Sets the signature date.

public virtual void SetSignDate(DateTime signDate)

Parameters

signDate DateTime

the signature date

SetSignatureAppearance(SignatureFieldAppearance)

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

public virtual void SetSignatureAppearance(SignatureFieldAppearance appearance)

Parameters

appearance SignatureFieldAppearance

the SignatureFieldAppearance layout element.

Remarks

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

SetSignatureCreator(string)

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

public virtual PdfSigner SetSignatureCreator(string signatureCreator)

Parameters

signatureCreator string

A new name of the application signing a document.

Returns

PdfSigner

this instance to support fluent interface.

SetSignatureEvent(ISignatureEvent)

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

public virtual void SetSignatureEvent(PdfSigner.ISignatureEvent signatureEvent)

Parameters

signatureEvent PdfSigner.ISignatureEvent

the signature event

SignDeferred(PdfDocument, string, Stream, IExternalSignatureContainer)

Signs a PDF where space was already reserved.

public static void SignDeferred(PdfDocument document, string fieldName, Stream outs, IExternalSignatureContainer externalSignatureContainer)

Parameters

document PdfDocument

the original PDF

fieldName string

the field to sign. It must be the last field

outs Stream

the output PDF

externalSignatureContainer IExternalSignatureContainer

the signature container doing the actual signing. Only the method ExternalSignatureContainer.sign is used

SignDetached(IExternalDigest, IExternalSignature, IX509Certificate[], ICollection<ICrlClient>, IOcspClient, ITSAClient, int, CryptoStandard)

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

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

Parameters

externalDigest IExternalDigest

an implementation that provides the digest

externalSignature IExternalSignature

the interface providing the actual signing

chain IX509Certificate[]

the certificate chain

crlList ICollection<ICrlClient>

the CRL list

ocspClient IOcspClient

the OCSP client

tsaClient ITSAClient

the Timestamp client

estimatedSize int

the reserved size for the signature. It will be estimated if 0

sigtype PdfSigner.CryptoStandard

Either Signature.CMS or Signature.CADES

Remarks

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.

SignDetached(IExternalDigest, IExternalSignature, IX509Certificate[], ICollection<ICrlClient>, IOcspClient, ITSAClient, int, CryptoStandard, ISignaturePolicyIdentifier)

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

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

Parameters

externalDigest IExternalDigest

an implementation that provides the digest

externalSignature IExternalSignature

the interface providing the actual signing

chain IX509Certificate[]

the certificate chain

crlList ICollection<ICrlClient>

the CRL list

ocspClient IOcspClient

the OCSP client

tsaClient ITSAClient

the Timestamp client

estimatedSize int

the reserved size for the signature. It will be estimated if 0

sigtype PdfSigner.CryptoStandard

Either Signature.CMS or Signature.CADES

signaturePolicy ISignaturePolicyIdentifier

the signature policy (for EPES signatures)

Remarks

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.

SignDetached(IExternalDigest, IExternalSignature, IX509Certificate[], ICollection<ICrlClient>, IOcspClient, ITSAClient, int, CryptoStandard, SignaturePolicyInfo)

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

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

Parameters

externalDigest IExternalDigest

an implementation that provides the digest

externalSignature IExternalSignature

the interface providing the actual signing

chain IX509Certificate[]

the certificate chain

crlList ICollection<ICrlClient>

the CRL list

ocspClient IOcspClient

the OCSP client

tsaClient ITSAClient

the Timestamp client

estimatedSize int

the reserved size for the signature. It will be estimated if 0

sigtype PdfSigner.CryptoStandard

Either Signature.CMS or Signature.CADES

signaturePolicy SignaturePolicyInfo

the signature policy (for EPES signatures)

Remarks

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.

SignDetached(IExternalSignature, IX509Certificate[], ICollection<ICrlClient>, IOcspClient, ITSAClient, int, CryptoStandard)

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

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

Parameters

externalSignature IExternalSignature

the interface providing the actual signing

chain IX509Certificate[]

the certificate chain

crlList ICollection<ICrlClient>

the CRL list

ocspClient IOcspClient

the OCSP client

tsaClient ITSAClient

the Timestamp client

estimatedSize int

the reserved size for the signature. It will be estimated if 0

sigtype PdfSigner.CryptoStandard

Either Signature.CMS or Signature.CADES

Remarks

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.

SignDetached(IExternalSignature, IX509Certificate[], ICollection<ICrlClient>, IOcspClient, ITSAClient, int, CryptoStandard, ISignaturePolicyIdentifier)

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

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

Parameters

externalSignature IExternalSignature

the interface providing the actual signing

chain IX509Certificate[]

the certificate chain

crlList ICollection<ICrlClient>

the CRL list

ocspClient IOcspClient

the OCSP client

tsaClient ITSAClient

the Timestamp client

estimatedSize int

the reserved size for the signature. It will be estimated if 0

sigtype PdfSigner.CryptoStandard

Either Signature.CMS or Signature.CADES

signaturePolicy ISignaturePolicyIdentifier

the signature policy (for EPES signatures)

Remarks

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.

SignDetached(IExternalSignature, IX509Certificate[], ICollection<ICrlClient>, IOcspClient, ITSAClient, int, CryptoStandard, SignaturePolicyInfo)

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

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

Parameters

externalSignature IExternalSignature

the interface providing the actual signing

chain IX509Certificate[]

the certificate chain

crlList ICollection<ICrlClient>

the CRL list

ocspClient IOcspClient

the OCSP client

tsaClient ITSAClient

the Timestamp client

estimatedSize int

the reserved size for the signature. It will be estimated if 0

sigtype PdfSigner.CryptoStandard

Either Signature.CMS or Signature.CADES

signaturePolicy SignaturePolicyInfo

the signature policy (for EPES signatures)

Remarks

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.

SignExternalContainer(IExternalSignatureContainer, int)

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

public virtual void SignExternalContainer(IExternalSignatureContainer externalSignatureContainer, int estimatedSize)

Parameters

externalSignatureContainer IExternalSignatureContainer

the interface providing the actual signing

estimatedSize int

the reserved size for the signature

Remarks

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.

Timestamp(ITSAClient, string)

Signs a document with a PAdES-LTV Timestamp.

public virtual void Timestamp(ITSAClient tsa, string signatureName)

Parameters

tsa ITSAClient

the timestamp generator

signatureName string

the signature name or null to have a name generated automatically

Remarks

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.