Foxit PDF SDK

Public Member Functions | Static Public Attributes | List of all members
com.foxit.sdk.pdf.Signature Class Reference
Inheritance diagram for com.foxit.sdk.pdf.Signature:

## Public Member Functions
| Signature (Field field)
| Constructor, with parent class object. More...
| Signature (PDFDoc document, PDFDictionary sig_field_dict)
| Constructor, from signature field dictionary. More...
boolean | clearSignedData () throws com.foxit.sdk.PDFException
| Clear the data and appearance if current signature is singed and verified valid. More...
synchronized void | delete ()
| Clean up related C++ resources immediately. More...
void | enableEmbedFont (boolean enable_embed_font)
| Enable or disable embed font. More...
void | enableIncrementalSaveForFirstSigning (boolean enable_incremental_save)
| Enable or disable incremental save for first signing. User should call this function before calling function Signature.startSign . Default: false. More...
boolean | generateAppearance () throws com.foxit.sdk.PDFException
| Generate the appearance of unsigned signature. More...
int | getAppearanceFlags () throws com.foxit.sdk.PDFException
| Get signature appearance flags. More...
Bitmap | getBitmap () throws com.foxit.sdk.PDFException
| Get a bitmap which is used for the signature appearance. More...
boolean | getByteRangeArray (int[] out_byte_range_array) throws com.foxit.sdk.PDFException
| Get the byte ranges data, including 4 elements. More...
String | getCert (int index) throws com.foxit.sdk.PDFException
| Get a certificate from current signature's certificate chain by index. More...
int | getCertCount () throws com.foxit.sdk.PDFException
| Get the count of certificates in current signature's certificate chain. More...
String | getCertificateInfo (String key) throws com.foxit.sdk.PDFException
| Get certificate information. More...
int | getDocPermission () throws com.foxit.sdk.PDFException
| Get document permission for current signature. More...
PDFDoc | getDocument () throws com.foxit.sdk.PDFException
| Get the PDF document, which current signature belongs to. More...
int | getFieldMDPAction () throws com.foxit.sdk.PDFException
| Get FieldMDP("MDP" means modification detection and prevention) action type. More...
WStringArray | getFieldMDPActionFields () throws com.foxit.sdk.PDFException
| Get the field name array which is used for FieldMDP action. More...
String | getFilter () throws com.foxit.sdk.PDFException
| Get filter. More...
String | getKeyLabel (int label_name) throws com.foxit.sdk.PDFException
| Get the string for specified key label. More...
String | getKeyValue (int key) throws com.foxit.sdk.PDFException
| Get the string value for specified key name. More...
int | getPAdESLevel () throws com.foxit.sdk.PDFException
| Get PAdES level. More...
SignatureArray | getPagingSealGroupElements () throws com.foxit.sdk.PDFException
| Get the group elements of current paging seal signature. More...
PagingSealSignature | getPagingSealSignature () throws com.foxit.sdk.PDFException
| Get the paging seal signature. More...
PDFDictionary | getSignatureDict () throws com.foxit.sdk.PDFException
| Get signature dictionary. More...
int | getSignatureType () throws com.foxit.sdk.PDFException
| Get signature type. More...
PDFDoc | getSignedVersionDocument (String file_path) throws com.foxit.sdk.PDFException
| Get the PDF document in the signed version in which current signature was signed. More...
DateTime | getSignTime () throws com.foxit.sdk.PDFException
| Get time of signing. More...
int | getState () throws com.foxit.sdk.PDFException
| Get current state. More...
String | getSubFilter () throws com.foxit.sdk.PDFException
| Get sub filter. More...
boolean | isEmpty ()
| Check whether current object is empty or not. More...
boolean | isSigned () throws com.foxit.sdk.PDFException
| Check whether current signature is signed or not. More...
boolean | isTimeStamp () throws com.foxit.sdk.PDFException
| Check if current signature is a time stamp signature. More...
void | setAppearanceContent (String appearance_content) throws com.foxit.sdk.PDFException
| Set customized appearance content (as low level drawing operation commands) for signed signature appearance. More...
void | setAppearanceFlags (int appearance_flags) throws com.foxit.sdk.PDFException
| Set signature appearance flags. More...
void | setBitmap (Bitmap bitmap) throws com.foxit.sdk.PDFException
| Set a bitmap for the signature appearance. More...
void | setCertChain (WStringArray cert_chain) throws com.foxit.sdk.PDFException
| Set a certificate chain. More...
void | setCustomObject (String key, PDFObject pdf_object) throws com.foxit.sdk.PDFException
| Set custom PDF object for signature dictionary. More...
void | setDefaultContentsLength (int default_length) throws com.foxit.sdk.PDFException
| Set the default length of signature contents which represents signature value (known as signed data). More...
void | setDocPermission (int permission) throws com.foxit.sdk.PDFException
| Set document permission for current signature. More...
void | setFieldMDPActionFields (int action, WStringArray field_array) throws com.foxit.sdk.PDFException
| Set FieldMDP("MDP" means modification detection and prevention) action names array. More...
void | setFilter (String filter) throws com.foxit.sdk.PDFException
| Set filter. More...
void | setImage (Image image, int frame_index) throws com.foxit.sdk.PDFException
| Set an image for the signature appearance, with a specified frame index. More...
void | setImage (String file_path, int frame_index) throws com.foxit.sdk.PDFException
| Set an image for the signature appearance, with a specified frame index. More...
void | setKeyLabel (int label_name, String label_value) throws com.foxit.sdk.PDFException
| Set the string for specified key label. More...
void | setKeyValue (int key, String value) throws com.foxit.sdk.PDFException
| Set the string value for specified key name. More...
void | setSignTime (DateTime sign_time) throws com.foxit.sdk.PDFException
| Set time of signing. More...
void | setSubFilter (String sub_filter) throws com.foxit.sdk.PDFException
| Set sub filter. More...
Progressive | startSign (String cert_path, byte[] cert_password, int digest_algorithm, String save_path, java.lang.Object client_data, PauseCallback pause) throws com.foxit.sdk.PDFException
| Start signing current signature if current signature is unsigned. More...
Progressive | startSign (StreamCallback cert_file_stream, byte[] cert_password, int digest_algorithm, String save_path, java.lang.Object client_data, PauseCallback pause) throws com.foxit.sdk.PDFException
| Start signing current signature if current signature is unsigned. More...
Progressive | startSign (String cert_path, byte[] cert_password, int digest_algorithm, StreamCallback stream_callback, java.lang.Object client_data, PauseCallback pause) throws com.foxit.sdk.PDFException
| Start signing current signature if current signature is unsigned. More...
Progressive | startSign (StreamCallback cert_file_stream, byte[] cert_password, int digest_algorithm, StreamCallback stream_callback, java.lang.Object client_data, PauseCallback pause) throws com.foxit.sdk.PDFException
| Start signing current signature if current signature is unsigned. More...
Progressive | startVerify (java.lang.Object client_data, PauseCallback pause) throws com.foxit.sdk.PDFException
| Start verifying the intergrity of current signature if current signature is signed. More...
Public Member Functions inherited from com.foxit.sdk.pdf.interform.Field
| Field (PDFDoc document, PDFDictionary field_dict) throws com.foxit.sdk.PDFException
| Constructor, from field dictionary. More...
| Field (Field field)
| Constructor, with another form field object. More...
synchronized void | delete ()
| Clean up related C++ resources immediately. More...
int | getAlignment () throws com.foxit.sdk.PDFException
| Get the alignment value. More...
String | getAlternateName () throws com.foxit.sdk.PDFException
| Get alternate name. More...
Control | getControl (int index) throws com.foxit.sdk.PDFException
| Get a form control by index. More...
Control | getControl (PDFPage page, int index) throws com.foxit.sdk.PDFException
| Get a form control by index, in a specified PDF page. More...
int | getControlCount () throws com.foxit.sdk.PDFException
| Get count of form controls. More...
int | getControlCount (PDFPage page) throws com.foxit.sdk.PDFException
| Get count of form controls in a specified PDF page. More...
DefaultAppearance | getDefaultAppearance () throws com.foxit.sdk.PDFException
| Get the default appearance data. More...
String | getDefaultValue () throws com.foxit.sdk.PDFException
| Get default value. More...
PDFObject | getDefaultValueObj () throws com.foxit.sdk.PDFException
| Get the PDF object of field's default value. More...
PDFDictionary | getDict () throws com.foxit.sdk.PDFException
| Get the PDF dictionary of current object. More...
int | getFlags () throws com.foxit.sdk.PDFException
| Get field flags. More...
PDFObject | getInheritedAttribute (String attribute_name) throws com.foxit.sdk.PDFException
| Get the PDF object for specified attribute which may be inherited from the ancestor node in the field tree. More...
String | getMappingName () throws com.foxit.sdk.PDFException
| Get mapping name. More...
int | getMaxLength () throws com.foxit.sdk.PDFException
| Get maximum length of the field's text, in characters. More...
String | getName () throws com.foxit.sdk.PDFException
| Get field name. More...
ChoiceOptionArray | getOptions () throws com.foxit.sdk.PDFException
| Get options of list box or combo box. More...
int | getTopVisibleIndex () throws com.foxit.sdk.PDFException
| Get top index of option for scrollable list boxes. More...
int | getType () throws com.foxit.sdk.PDFException
| Get field type. More...
String | getValue () throws com.foxit.sdk.PDFException
| Get value. More...
PDFObject | getValueObj () throws com.foxit.sdk.PDFException
| Get the PDF object of field's value. More...
boolean | isEmpty ()
| Check whether current object is empty or not. More...
boolean | reset () throws com.foxit.sdk.PDFException
| Reset data in current field to its default value. (Not support signature field) More...
void | setAlignment (int alignment) throws com.foxit.sdk.PDFException
| Set alignment property of a form, as a document-wide default value. (Not support signature field) More...
void | setAlternateName (String alternate_name) throws com.foxit.sdk.PDFException
| Set alternate name. (Not support signature field) More...
void | setDefaultAppearance (DefaultAppearance default_ap) throws com.foxit.sdk.PDFException
| Set default appearance data. More...
void | setDefaultValue (String value) throws com.foxit.sdk.PDFException
| Set default value. More...
void | setFlags (int flags) throws com.foxit.sdk.PDFException
| Set field flags. More...
void | setMappingName (String name) throws com.foxit.sdk.PDFException
| Set mapping name. (Not support signature field) More...
void | setMaxLength (int max_length) throws com.foxit.sdk.PDFException
| Set maximum length of the field's text, in characters. More...
void | setOptions (ChoiceOptionArray option_array) throws com.foxit.sdk.PDFException
| Set options of list box or combo box. More...
void | setTopVisibleIndex (int index) throws com.foxit.sdk.PDFException
| Set top index for scrollable list boxes. More...
void | setValue (String value) throws com.foxit.sdk.PDFException
| Set value. More...
Public Member Functions inherited from com.foxit.sdk.common.Base
synchronized void | delete ()
| Clean up related C++ resources immediately. More...

## Static Public Attributes
static final int | e_APFlagBitmap = 0x0080
| If set, show bitmap on signature appearance.
static final int | e_APFlagDN = 0x0010
| If set, show distinguish name on signature appearance.
static final int | e_APFlagFoxitEditorFlag = 0x0200
| If set, show Foxit Editor content on signature appearance.
static final int | e_APFlagFoxitFlag = 0x0001
| If set, show Foxit flag on signature appearance.
static final int | e_APFlagLabel = 0x0002
| If set, show label on signature appearance.
static final int | e_APFlagLocation = 0x0020
| If set, show location on signature appearance.
static final int | e_APFlagProducer = 0x0400
| If set, show producer content on signature appearance.
static final int | e_APFlagReason = 0x0004
| If set, show reason on signature appearance.
static final int | e_APFlagSigner = 0x0040
| If set, show signer on signature appearance.
static final int | e_APFlagSigningTime = 0x0008
| If set, show signing time on signature appearance.
static final int | e_APFlagText = 0x0100
| If set, show text content on signature appearance.
static final int | e_DigestSHA1 = 0
| Signature digest algorithm: sha1 algorithm.
static final int | e_DigestSHA256 = 1
| Signature digest algorithm: sha256 algorithm.
static final int | e_DigestSHA384 = 2
| Signature digest algorithm: sha384 algorithm.
static final int | e_DigestSHA512 = 3
| Signature digest algorithm: sha512 algorithm.
static final int | e_DocPermFillingFormAndSigning = 2
| Permitted changes are filling in forms, instantiating page templates, and signing. Other changes will invalidate the signature.
static final int | e_DocPermFillingFormSigningAndAnnotating = 3
| Permitted changes are the same as for 2, as well as annotation creation, deletion, and modification. Other changes will invalidate the signature.
static final int | e_DocPermNoChangesAllowed = 1
| No changes to the PDF document (which is signed by the signture) are permitted. Any change to this kind of PDF document will invalidate the signature.
static final int | e_DocPermUnrestricted = 0
| No restriction.
static final int | e_FieldMDPActionAll = 1
| All form fields' flags will be set read-only.
static final int | e_FieldMDPActionExclude = 3
| Flags of form fields (except specified form fields) will be set read-only. More...
static final int | e_FieldMDPActionInclude = 2
| Specified form fields' flags will be set read-only. More...
static final int | e_FieldMDPActionNone = 0
| No Field MDP action.
static final int | e_KeyNameContactInfo = 3
| Signature key name: contact information.
static final int | e_KeyNameDN = 4
| Signature key name: distinguish name.
static final int | e_KeyNameLocation = 1
| Signature key name: location.
static final int | e_KeyNameProducer = 6
| Signature key name: producer content.
static final int | e_KeyNameReason = 2
| Signature key name: reason.
static final int | e_KeyNameSigner = 0
| Signature key name: signer.
static final int | e_KeyNameText = 5
| Signature key name: text content.
static final int | e_LabelNameDN = 4
| Signature key name for distinguish name. More...
static final int | e_LabelNameLocation = 1
| Signature label name for location. More...
static final int | e_LabelNameProducer = 6
| Signature key name for producer name. More...
static final int | e_LabelNameReason = 2
| Signature label name for reason. More...
static final int | e_LabelNameSigner = 0
| Signature label name for signer. More...
static final int | e_LabelNameSignTime = 3
| Signature label name for sign time. More...
static final int | e_PAdESLevelBB = 2
| PAdES level: B-B.
static final int | e_PAdESLevelBLT = 4
| PAdES level: B-LT.
static final int | e_PAdESLevelBLTA = 5
| PAdES level: B-LTA.
static final int | e_PAdESLevelBT = 3
| PAdES level: B-T.
static final int | e_PAdESLevelNone = 1
| PAdES level: none.
static final int | e_PAdESLevelNotPAdES = 0
| Not a PAdES signature.
static final int | e_SignatureTypeOrdinary = 0
| Signature type: ordinary.
static final int | e_SignatureTypePagingSeal = 4
| Signature type: paging seal.
static final int | e_SignatureTypeTimeStamp = 3
| Signature type: time stamp.
static final int | e_StateCertCannotGetVRI = 0x04000000
| Cannot get verify relevant information.
static final int | e_StateNoSignData = 0x00000200
| Signature does not have any data for signing.It means that there is not "V" entry in the signature dictionary.
static final int | e_StateSigned = 0x00000002
| Signed signature.
static final int | e_StateUnknown = 0x80000000
| Unknown signature.
static final int | e_StateUnsigned = 0x00000001
| Unsigned signature.
static final int | e_StateVerifyChange = 0x00000080
| The document has been changed within the scope of the signature. (This indicates that signature is invalid.)
static final int | e_StateVerifyChangeIllegal = 0x10000000
| The document has been changed outside of signature scope, and the changed invalidate the signature.
static final int | e_StateVerifyChangeLegal = 0x08000000
| The document has been changed outside of signature scope, but the changed is permitted.
static final int | e_StateVerifyErrorByteRange = 0x00000040
| Non expected byte range.
static final int | e_StateVerifyErrorData = 0x00000010
| Signature data is destroyed (that means the signature data cannot be parsed properly).
static final int | e_StateVerifyIncredible = 0x00000100
| Signature cannot be trusted (containing aggression).
static final int | e_StateVerifyInvalid = 0x00000008
| Verification state of a signature is invalid.
static final int | e_StateVerifyIssueCurrent = 0x00020000
| The verified issue is current issuer.
static final int | e_StateVerifyIssueExpire = 0x00008000
| Certificate for verifying issuer is expired.
static final int | e_StateVerifyIssueRevoke = 0x00004000
| Certificate for verifying issuer is revoked.
static final int | e_StateVerifyIssueUncheck = 0x00010000
| Not check the issuer.
static final int | e_StateVerifyIssueUnknown = 0x00002000
| Verification state of the issuer is unknown.
static final int | e_StateVerifyIssueValid = 0x00001000
| Verification state of the issuer is valid.
static final int | e_StateVerifyNoChange = 0x00000400
| The document has not been changed within the scope of the signature.
static final int | e_StateVerifyNoSupportWay = 0x00000020
| Unsupported signature.
static final int | e_StateVerifyTimestampDoc = 0x00080000
| The signature is a time stamp signature.
static final int | e_StateVerifyTimestampExpire = 0x00400000
| Verification state of the time stamp is expired.
static final int | e_StateVerifyTimestampInvalid = 0x00200000
| Verification state of the time stamp is invalid.
static final int | e_StateVerifyTimestampIssueUnknown = 0x00800000
| Verification state of the time stamp issuer is unknown.
static final int | e_StateVerifyTimestampIssueValid = 0x01000000
| Verification state of the time stamp issuer is valid.
static final int | e_StateVerifyTimestampNone = 0x00040000
| No time stamp or not check time stamp.
static final int | e_StateVerifyTimestampTimeBefore = 0x02000000
| Verification state of the time stamp time is valid, since the times is before the expiration date.
static final int | e_StateVerifyTimestampValid = 0x00100000
| Verification state of the time stamp is valid.
static final int | e_StateVerifyValid = 0x00000004
| Verification state of a signature is valid.
Static Public Attributes inherited from com.foxit.sdk.pdf.interform.Field
static final int | e_FlagButtonNoToggleToOff = 0x100
| (Only useful for radio button) If set, exactly one radio button must be selected at all times; clicking the currently selected button has no effect. If clear, clicking the selected button deselects it, leaving no button selected.
static final int | e_FlagButtonRadiosInUnison = 0x200
| (Only useful for radio button) If set, a group of radio buttons within a radio button field that use the same value for the on state will turn on and off in unison; that is if one is checked, they are all checked. If clear, the buttons are mutually exclusive.
static final int | e_FlagChoiceCommitOnSelChange = 0x400
| (Only useful for choice field) If set, the new value is committed as soon as a selection is made with the pointing device; if clear, the new value is not committed until the user exits the field.
static final int | e_FlagChoiceMultiSelect = 0x100
| (Only useful for list box) If set, more than one items may be selected simultaneously; if clear, no more than one item at a time may be selected.
static final int | e_FlagChoiceSort = 0x200
| (Only useful for choice field) If set, the field's option items should be sorted alphabetically.
static final int | e_FlagComboEdit = 0x100
| (Only useful for combo box) If set, the combo box includes an editable text control with a drop-down list, if clear, it includes only a drop-down list.
static final int | e_FlagNoExport = 0x04
| if set, the field must not be exported by a submit-form action.
static final int | e_FlagReadOnly = 0x01
| If set, the user may not change the value of the field. Any associated widget annotations will not interact with the user; that is, they will not respond to mouse clicks or change their appearance in response to mouse motions. This flag is useful for fields whose values are computed or imported from a database.
static final int | e_FlagRequired = 0x02
| If set, the field must have a value at the time it is exported by a submit-form action.
static final int | e_FlagTextComb = 0x2000
| (Only useful for text field) If set, use combs. More...
static final int | e_FlagTextDoNotScroll = 0x1000
| (Only useful for text field) If set, the field does not scroll (horizontally for single-line fields, vertically for multiple-line fields) to accommodate more text than fits within its annotation rectangle. Once the field is full, no further text is accepted.
static final int | e_FlagTextFileSelect = 0x400
| (Only useful for text field) If set, the text entered in the field represents the pathname of a file whose contents are to be submitted as the value of the field.
static final int | e_FlagTextMultiline = 0x100
| (Only useful for text field) If set, the text field can contain multiple lines of text; if clear, the field's text is restricted to a single line.
static final int | e_FlagTextNoSpellCheck = 0x800
| (Only useful for text field) If set, text entered in the field is not spell-checked.
static final int | e_FlagTextPassword = 0x200
| (Only useful for text field) If set, the field is intended for entering a secure password that should not be echoed visibly to the screen. Characters typed from the keyboard should instead be echoed in some unreadable form, such as asterisks or bullet characters. More...
static final int | e_FlagTextRichText = 0x4000
| (Only useful for text field) If set, the value of this field should be represented as a rich text string.
static final int | e_TypeCheckBox = 2
| Form field type: check box.
static final int | e_TypeComboBox = 4
| Form field type: combo box.
static final int | e_TypeListBox = 5
| Form field type: list box.
static final int | e_TypePushButton = 1
| Form field type: push button.
static final int | e_TypeRadioButton = 3
| Form field type: radio button.
static final int | e_TypeSignature = 7
| Form field type: signature field.
static final int | e_TypeTextField = 6
| Form field type: text field.
static final int | e_TypeUnknown = 0
| Form field type: unknown.

## Detailed Description

A digital signature (PDF 1.3) can be used to authenticate the identity of a user and the document's contents. It stores information about the signer and the state of the document when it was signed. The signature is contained in a signature field, as a type of form field, so class Signature is derived from class com.foxit.sdk.pdf.interform.Field . A signature object can be retrieved/added by following functions:

- To be counted and retrieved as a signature object directly from PDF document, please use functions pdf.PDFDoc.getSignatureCount and PDFDoc.getSignature .

- To be counted and retrieved as a signature field, please use functions interform.Form.getFieldCount and interform.Form.getField when field type is com.foxit.sdk.pdf.interform.Field.e_TypeSignature .

- To add a new signature, please use function PDFPage.addSignature .

- To remove a signature, please use function PDFDoc.removeSignature .

In a signature, filter and sub filter keys are used to specify the filter and sub filter of signature callback object which will be used to sign and verify the signature. Foxit PDF SDK has default signature callbacks for following filter and sub filter:

- filter: "Adobe.PPKLite" and sub filter: "adbe.pkcs7.detached"

- filter: "Adobe.PPKLite" and sub filter: "adbe.pkcs7.sha1"

- filter: "Adobe.PPKLite" and sub filter: "ETSI.CAdES.detached"

- filter: "Adobe.PPKLite" and sub filter: "ETSI.RFC3161"

For sub filter "ETSI.CAdES.detached" and sub filter "ETSI.RFC3161", please ensure a default time stmap server has been set to TimeStampServerMgr if default signature callbacks for them will be used to do signing. For other filter and sub filter or if user wants to use customized signature callback for above filter and sub filter, user should prepare customized signature callback and register the callback to Foxit PDF SDK by function common.Library.registerSignatureCallback .
This class offers functions to get/set signature information/properties, sign or verify a signature, and so on. For example:

- To sign an unsigned signature, please use functions Signature.startSign . When signing a signature successfully, user is strongly recommended to close current document and then open the signed PDF document and then do following operation.

- To verify the integrity of a signed signature, please use functions Signature.startVerify . To check if a signed signature is valid or not, please refer to class LTVVerifier .

- To retrieve signature dictionary directly, please use function Signature.getSignatureDict .

Before signing an unsigned signature, user can call following functions to set information for signing and signed appearance:

- For using default Foxit appearance template, related information can be set by Signature.setAppearanceFlags , Signature.setSignTime , Signature.setKeyValue , Signature.setBitmap , Signature.setImage .

- For using customized appearance, please set appearance stream content by function Signature.setAppearanceContent .

If an unsigned signature has been set some information for signing, but the document is saved directly or closed without signing the signature, these data (including filter and sub filter) will be lost in the saved document or in the closed document. When the document is opened again, the unsigned signature needs to be specified at least filter and sub filter for signing; otherwise, this signature cannot be signed.

See also
  com.foxit.sdk.pdf.interform.Field
  com.foxit.sdk.pdf.interform.Form
  PDFDoc
  PDFPage
  TimeStampServerMgr
  LTVVerifier

## Constructor & Destructor Documentation

## ◆ Signature() [1/2]

com.foxit.sdk.pdf.Signature.Signature | ( | Field | field | ) |

Constructor, with parent class object.

Parameters

  [in] | field | Parent class object.

## ◆ Signature() [2/2]

com.foxit.sdk.pdf.Signature.Signature | ( | PDFDoc | document,
|  | PDFDictionary | sig_field_dict
| ) |  |

Constructor, from signature field dictionary.

Parameters

  [in] | document | A valid PDF document.
  [in] | sig_field_dict | A PDF dictionary which represents a signature field. It should belong to the PDF document specified by parameter document;

## Member Function Documentation

## ◆ clearSignedData()

boolean com.foxit.sdk.pdf.Signature.clearSignedData | ( |  | ) | throws com.foxit.sdk.PDFException

Clear the data and appearance if current signature is singed and verified valid.

This function is used for a signed and valid signature.
Attention: From 7.0, this function is only used to verify the intergrity of a signature. To check if a signature is valid or not, please refer to class LTVVerifier .

Returns
  true means clear the data and appearance successfully, while false means no need to clear data and appearance or any error.

## ◆ delete()

synchronized void com.foxit.sdk.pdf.Signature.delete | ( |  | ) |

Clean up related C++ resources immediately.

Returns
  None.

Note
  Once this function is called, current object cannot be used anymore.

## ◆ enableEmbedFont()

void com.foxit.sdk.pdf.Signature.enableEmbedFont | ( | boolean | enable_embed_font | ) |

Enable or disable embed font.

Parameters

  A | flag indicates that whether to embed font for siganture's text. true means that embed font for siganture's text. false means that not to embed font for siganture's text.

Returns
  None.

## ◆ enableIncrementalSaveForFirstSigning()

void com.foxit.sdk.pdf.Signature.enableIncrementalSaveForFirstSigning | ( | boolean | enable_incremental_save | ) |

Enable or disable incremental save for first signing. User should call this function before calling function Signature.startSign .
Default: false.

Parameters

  [in] | enable_incremental_save | A flag indicates that whether to use incremental save for first signing. true means that use incremental save for first signing. false means that use default save for first signing.

Returns
  None.

## ◆ generateAppearance()

boolean com.foxit.sdk.pdf.Signature.generateAppearance | ( |  | ) | throws com.foxit.sdk.PDFException

Generate the appearance of unsigned signature.

This function is used to display the unsigned ordinary signature on page without calling the function Signature.startSign .

Returns
  true means success, while false means failure.

## ◆ getAppearanceFlags()

int com.foxit.sdk.pdf.Signature.getAppearanceFlags | ( |  | ) | throws com.foxit.sdk.PDFException

Get signature appearance flags.

Signature appearance flags indicate which information will be shown. Currently, this is only useful after Signature.setAppearanceFlags is set successfully. For a signature gotten from PDF document, the return value of this function would be useless.

Returns
  Signature appearance flags. Please refer to values starting from com.foxit.sdk.pdf.Signature.e_APFlagFoxitFlag and this would be one or a combination of these values.

## ◆ getBitmap()

Bitmap com.foxit.sdk.pdf.Signature.getBitmap | ( |  | ) | throws com.foxit.sdk.PDFException

Get a bitmap which is used for the signature appearance.

Returns
  The bitmap used in appearance. If the return value of function common.Bitmap.isEmpty for the returned bitmap object is true, that means no bitmap is used in appearance or there is any error.

## ◆ getByteRangeArray()

boolean com.foxit.sdk.pdf.Signature.getByteRangeArray | ( | int [] | out_byte_range_array | ) | throws com.foxit.sdk.PDFException

Get the byte ranges data, including 4 elements.

This function is used for a signed signature to retrieve its byte range for digest calculation. The array of byte ranges contains 4 elements. These 4 elements are always in pairs of integers (starting byte offset, length in bytes), describing the exact byte range for the digest calculation.
Please refer to <PDF Reference 1.7> Section 8.7 Digital Signatures for more details.

Parameters

  [out] | out_byte_range_array | Output parameter that receives data of byte ranges. Please ensure this array can contain 4 elements.

Returns
  true means success, while false means failure.

## ◆ getCert()

String com.foxit.sdk.pdf.Signature.getCert | ( | int | index | ) | throws com.foxit.sdk.PDFException

Get a certificate from current signature's certificate chain by index.

This function is recommended to be used before verifying a signature. When sub filter of current signature is "adbe.x509.rsa_sha1", application needs to call this function to get verified public certificate before verifying signature. The first certificate in certificate chain is the signing certificate, and it can be used to verify the signature.

Parameters

  [in] | index | The index of certificate to be gotten. Valid range: from 0 to (count-1). count is returned by function Signature.getCertCount .

Returns
  A certificate.

## ◆ getCertCount()

int com.foxit.sdk.pdf.Signature.getCertCount | ( |  | ) | throws com.foxit.sdk.PDFException

Get the count of certificates in current signature's certificate chain.

This function is recommended to be used before verifying a signature. When sub filter of current signature is "adbe.x509.rsa_sha1", application needs to call this function to get the count of certificates in certificate chain and then call function Signature.getCert to get verified public certificate before verifying signature.

Returns
  The count of certificates.

## ◆ getCertificateInfo()

String com.foxit.sdk.pdf.Signature.getCertificateInfo | ( | String | key | ) | throws com.foxit.sdk.PDFException

Get certificate information.

This function is used for a signed signature. Currently, this function only supports for iOS and android platform.

Parameters

  [in] | key | Certificate key string. Currently it can be one of the following keys: "SerialNumber" "Issuer" "Subject" "ValidPeriodFrom" "ValidPeriodTo"

Returns
  Certificate information string.

Note
  For "ValidPeriodFrom" or "ValidPeriodTo" key, timezone value will not be computed in.

## ◆ getDocPermission()

int com.foxit.sdk.pdf.Signature.getDocPermission | ( |  | ) | throws com.foxit.sdk.PDFException

Get document permission for current signature.

- If permission value is not com.foxit.sdk.pdf.Signature.e_DocPermUnrestricted , that means adding new signature will fail when current signature is signed

- If permission value is com.foxit.sdk.pdf.Signature.e_DocPermFillingFormAndSigning or com.foxit.sdk.pdf.Signature.e_DocPermFillingFormSigningAndAnnotating , that means current signature field's flag is read-only when current signature is signed.

Returns
  The document permission.Please refer to values starting from com.foxit.sdk.pdf.Signature.e_DocPermUnrestricted and this should be one of these values.

## ◆ getDocument()

PDFDoc com.foxit.sdk.pdf.Signature.getDocument | ( |  | ) | throws com.foxit.sdk.PDFException

Get the PDF document, which current signature belongs to.

Returns
  A PDF document object.

## ◆ getFieldMDPAction()

int com.foxit.sdk.pdf.Signature.getFieldMDPAction | ( |  | ) | throws com.foxit.sdk.PDFException

Get FieldMDP("MDP" means modification detection and prevention) action type.

Returns
  FieldMDP action type. Please refer to values starting from com.foxit.sdk.pdf.Signature.e_FieldMDPActionNone and this should be one of these values.

## ◆ getFieldMDPActionFields()

WStringArray com.foxit.sdk.pdf.Signature.getFieldMDPActionFields | ( |  | ) | throws com.foxit.sdk.PDFException

Get the field name array which is used for FieldMDP action.

Returned field name array is associated to the FieldMDP action (which can be checked by function Signature.getFieldMDPAction ):

- If FieldMDP action type is com.foxit.sdk.pdf.Signature.e_FieldMDPActionNone , returned field name array is uselss.

- If FieldMDP action type is com.foxit.sdk.pdf.Signature.e_FieldMDPActionAll , returned field name array will contain name of all form fields.

- If FieldMDP action type is com.foxit.sdk.pdf.Signature.e_FieldMDPActionInclude , returned field name array specifies form fields whose flags are read-only when current signature is signed.

- If FieldMDP action type is com.foxit.sdk.pdf.Signature.e_FieldMDPActionExclude , returned field name array specifies form fields whose flags are not read-only (but rest fields' flags are read-only) when current signature is a signed signature.

Returns
  FieldMDP action field name array.

## ◆ getFilter()

String com.foxit.sdk.pdf.Signature.getFilter | ( |  | ) | throws com.foxit.sdk.PDFException

Get filter.

Filter and sub filter are used to specify which registered signature callback object will be used to sign/verify current signature.

Returns
  Filter string.

## ◆ getKeyLabel()

String com.foxit.sdk.pdf.Signature.getKeyLabel | ( | int | label_name | ) | throws com.foxit.sdk.PDFException

Get the string for specified key label.

If current signature is a time stamp signature, this function will always return an empty string.

Parameters

  [in] | label_name | Key label. Please refer to values starting from com.foxit.sdk.pdf.Signature.e_LabelNameSigner and this should be one of these values.

Returns
  String for specified key label.

## ◆ getKeyValue()

String com.foxit.sdk.pdf.Signature.getKeyValue | ( | int | key | ) | throws com.foxit.sdk.PDFException

Get the string value for specified key name.

This function is used to get string value of some key in signature dictionary, such as "Reason", "Location" and so on. Specially,

Parameters

  [in] | key | Key name. Please refer to values starting from com.foxit.sdk.pdf.Signature.e_KeyNameSigner and this should be one of these values.

Returns
  The string value.

## ◆ getPAdESLevel()

int com.foxit.sdk.pdf.Signature.getPAdESLevel | ( |  | ) | throws com.foxit.sdk.PDFException

Get PAdES level.

Returns
  PAdES level. Please refer to values starting from com.foxit.sdk.pdf.Signature.e_PAdESLevelNotPAdES and this would be one of these values.

## ◆ getPagingSealGroupElements()

SignatureArray com.foxit.sdk.pdf.Signature.getPagingSealGroupElements | ( |  | ) | throws com.foxit.sdk.PDFException

Get the group elements of current paging seal signature.

If current signature type is com.foxit.sdk.pdf.Signature.e_SignatureTypePagingSeal , this function will return the array of signature associated with current signature. Otherwise, an empty array will be returned.

Returns
  A signature array.

## ◆ getPagingSealSignature()

PagingSealSignature com.foxit.sdk.pdf.Signature.getPagingSealSignature | ( |  | ) | throws com.foxit.sdk.PDFException

Get the paging seal signature.

If current signature type is com.foxit.sdk.pdf.Signature.e_SignatureTypePagingSeal , this function will return the paging seal signature object associated with current signature.

Returns
  A PagingSealSignature object. If the return value of function Signature.isEmpty for the returned object is true, that means current signature is not paging seal signature.

## ◆ getSignatureDict()

PDFDictionary com.foxit.sdk.pdf.Signature.getSignatureDict | ( |  | ) | throws com.foxit.sdk.PDFException

Get signature dictionary.

Signature dictionary is a part of signature field dictionary.

Returns
  The signature dictionary. If there is any error, this function will return null.

## ◆ getSignatureType()

int com.foxit.sdk.pdf.Signature.getSignatureType | ( |  | ) | throws com.foxit.sdk.PDFException

Get signature type.

Returns
  Signature type. Please refer to values starting from com.foxit.sdk.pdf.Signature.e_SignatureTypeOrdinary and this would be one of these values.

## ◆ getSignedVersionDocument()

PDFDoc com.foxit.sdk.pdf.Signature.getSignedVersionDocument | ( | String | file_path | ) | throws com.foxit.sdk.PDFException

Get the PDF document in the signed version in which current signature was signed.

This function is useful when a PDF document has benn signed by serveral signatures and user wants to get the PDF document in which one signature is signed.

Parameters

  [in] | file_path | The full path of the original opened PDF document which current signature belongs to. It should not be an empty string.

Returns
  A PDF document object in singed version in which current signature was signed. The returned PDF document may represent a differenct PDF document from current PDF document where current signature is retrieved, or is just current PDF document. User should ensure to keep current PDF document object valid when reading or operating signed version document. Please ensure the returned document object has been loaded successfully, before using most functions in class PDFDoc .

## ◆ getSignTime()

DateTime com.foxit.sdk.pdf.Signature.getSignTime | ( |  | ) | throws com.foxit.sdk.PDFException

Get time of signing.

Returns
  A date and time object that receives the signing time. If no signing time is found, this function will return a date and time object with all values 0.

## ◆ getState()

int com.foxit.sdk.pdf.Signature.getState | ( |  | ) | throws com.foxit.sdk.PDFException

Get current state.

- Before verifying a signature, this function is to get the state about if current signature is signed or if current signature is lack of data for signing.

- After verifying a signature, this function is to get the verified state – which indicates that the verified signature is signed; if the verified signature is still unsigned, this function will get the unsigned state instead.

Returns
  The value of signature state. Please refer to values starting from com.foxit.sdk.pdf.Signature.e_StateUnknown and this would be one or combination of them.
  Specially, if the returned state is com.foxit.sdk.pdf.Signature.e_StateNoSignData , that means current signature has no data for signing, and please at least call function Signature.setKeyValue to set necessary filter and sub filter to current signature. Use can also call following functions to set other data for signing and signed appearance before calling function Signature.startSign :

  - For using default Foxit appearance template, related information can be set by Signature.setAppearanceFlags , Signature.setSignTime , Signature.setKeyValue , Signature.setBitmap , Signature.setImage .

  - For using customized appearance, please set appearance stream content by function Signature.setAppearanceContent .

## ◆ getSubFilter()

String com.foxit.sdk.pdf.Signature.getSubFilter | ( |  | ) | throws com.foxit.sdk.PDFException

Get sub filter.

Filter and sub filter are used to specify which registered signature callback object will be used to sign/verify current signature.

Returns
  Sub filter string.

## ◆ isEmpty()

boolean com.foxit.sdk.pdf.Signature.isEmpty | ( |  | ) |

Check whether current object is empty or not.

When the current object is empty, that means current object is useless.

Returns
  true means current object is empty, while false means not.

## ◆ isSigned()

boolean com.foxit.sdk.pdf.Signature.isSigned | ( |  | ) | throws com.foxit.sdk.PDFException

Check whether current signature is signed or not.

Returns
  true means current signature is signed, and false means not.

## ◆ isTimeStamp()

boolean com.foxit.sdk.pdf.Signature.isTimeStamp | ( |  | ) | throws com.foxit.sdk.PDFException

Check if current signature is a time stamp signature.

Returns
  true means current signature is a time stamp signature, while false means not.

## ◆ setAppearanceContent()

void com.foxit.sdk.pdf.Signature.setAppearanceContent | ( | String | appearance_content | ) | throws com.foxit.sdk.PDFException

Set customized appearance content (as low level drawing operation commands) for signed signature appearance.

This function can only be used for an unsigned signature before calling function Signature.startSign for the unsigned signature.
Once customized appearance content is set, it will be used as the signed appearance. In this case, appearance flags set by Signature.setAppearanceFlags will be ignored and related informations will not be used in appearance – these information are set by: Signature.setSignTime , Signature.setKeyValue (except filter and sub-filter), Signature.setBitmap , Signature.setImage .
If current signature is a time stamp signature, this function will do nothing.

Parameters

  [in] | appearance_content | Customized appearance content. This should be sequence of drawing operation commands to be used for the appearance, for example "10 10 m 20 10 l S". Please refer to <PDF Reference 1.7> P196 for more details.

Returns
  None.

## ◆ setAppearanceFlags()

void com.foxit.sdk.pdf.Signature.setAppearanceFlags | ( | int | appearance_flags | ) | throws com.foxit.sdk.PDFException

Set signature appearance flags.

This function is recommended to be used before calling function Signature.startSign for an unsigned signature.
Signature appearance flags indicate which information will be shown in the signed appearance. If customized appearance content has been set by function Signature.setAppearanceContent , appearance flags will be ignored.
If current signature is a time stamp signature, this function will do nothing.

Parameters

  [in] | appearance_flags | Signature appearance flags. Please refer to values starting from com.foxit.sdk.pdf.Signature.e_APFlagFoxitFlag and this should be one or a combination of these values.

Returns
  None.

## ◆ setBitmap()

void com.foxit.sdk.pdf.Signature.setBitmap | ( | Bitmap | bitmap | ) | throws com.foxit.sdk.PDFException

Set a bitmap for the signature appearance.

This function is recommended to be used before calling function Signature.startSign for an unsigned signature. If customized appearance content has been set by function Signature.setAppearanceContent , the bitmap will not be used in signed appearance.
If current signature is a time stamp signature, this function will do nothing.

Parameters

  [in] | bitmap | A bitmap to be set to the appearance. It should be valid.

Returns
  None.

## ◆ setCertChain()

void com.foxit.sdk.pdf.Signature.setCertChain | ( | WStringArray | cert_chain | ) | throws com.foxit.sdk.PDFException

Set a certificate chain.

This function is recommended to be used before signing an unsigned signature. When the signature sub filter is "adbe.x509.rsa_sha1", users need to call this function to set the cert chain to the signature. For other sub filter, this function will return directly without doing anything.

Parameters

  [in] | cert_chain | A string array that represents the certificate chain.

Returns
  None.

## ◆ setCustomObject()

void com.foxit.sdk.pdf.Signature.setCustomObject | ( | String | key,
|  | PDFObject | pdf_object
| ) |  | throws com.foxit.sdk.PDFException

Set custom PDF object for signature dictionary.

This function is recommended to be used before calling function Signature.startSign for an unsigned signature.

Parameters

  [in] | key | The key of signature dictionary, whose value element will be set. It should not be an empty string.
  [in] | pdf_object | A custom PDFObject object to be set as the key's value. It should not be null. It can be a direct PDF object or an indirect PDF object.

Returns
  None.

## ◆ setDefaultContentsLength()

void com.foxit.sdk.pdf.Signature.setDefaultContentsLength | ( | int | default_length | ) | throws com.foxit.sdk.PDFException

Set the default length of signature contents which represents signature value (known as signed data).

This function can only be used before function Signature.startSign for an unsigned signature.
Signature contents represent the signature value (known as signed data). When initializing the signature field, the signature contents will be initialized with the default length 7942. When using custom signature callback to sign and verify an unsigned signature, user can call this function to change the default length of signature contents. In this case, user should also ensure that the length of returned signed data in callback function SignatureCallback.sign should not be larger than the default length set by this function.

Parameters

  [in] | default_length | The default length of the signature value (known as signed data), in bytes. It should not be less than 4098.

Returns
  None.

## ◆ setDocPermission()

void com.foxit.sdk.pdf.Signature.setDocPermission | ( | int | permission | ) | throws com.foxit.sdk.PDFException

Set document permission for current signature.

This function is only useful for an unsigned signature. If this function is used for a signed signature, nothing will be done.
Some notes about the permission value:

- If any permission value except com.foxit.sdk.pdf.Signature.e_DocPermUnrestricted is set to current unsigned signature, then adding new signature will fail when current signature is a signed signature.

- If permission value com.foxit.sdk.pdf.Signature.e_DocPermFillingFormAndSigning or com.foxit.sdk.pdf.Signature.e_DocPermFillingFormSigningAndAnnotating is set to current unsigned signature, then FieldMDP action would be com.foxit.sdk.pdf.Signature.e_FieldMDPActionInclude and current signature field's flag would be read-only when current signature is a signed signature.

Parameters

  [in] | permission | The document permission. Please refer to values starting from com.foxit.sdk.pdf.Signature.e_DocPermUnrestricted and this should be one of these values.

Returns
  None.

## ◆ setFieldMDPActionFields()

void com.foxit.sdk.pdf.Signature.setFieldMDPActionFields | ( | int | action,
|  | WStringArray | field_array
| ) |  | throws com.foxit.sdk.PDFException

Set FieldMDP("MDP" means modification detection and prevention) action names array.

This function is only useful for an unsigned signature. If this function is used for a signed signature, nothing will be done.
If current signature is signed, this function is invalidate.

Parameters

  [in] | action | FieldMDP action type.Please refer to values starting from com.foxit.sdk.pdf.Signature.e_FieldMDPActionNone and this should be one of these values. If this value is com.foxit.sdk.pdf.Signature.e_FieldMDPActionNone , that means no FieldMDP action will be used. If this value is com.foxit.sdk.pdf.Signature.e_FieldMDPActionAll , parameter field_array will be ignored and all fields will be included in the object digest (and hence do not permit changes after current signature is signed). If this value is com.foxit.sdk.pdf.Signature.e_FieldMDPActionInclude , that means only flags of form fields specified by parameter field_array will be set read-only and these fields will be included in the object digest (and hence do not permit changes after current signature is signed). If this value is com.foxit.sdk.pdf.Signature.e_FieldMDPActionExclude , that means flags of form fields (except those specified by parameter field_array) will be set read-only and these fields are included in the object digest (and hence do not permit changes after current signature is signed).
  [in] | field_array | A field name array used for FieldMDP action.

Returns
  None.

## ◆ setFilter()

void com.foxit.sdk.pdf.Signature.setFilter | ( | String | filter | ) | throws com.foxit.sdk.PDFException

Set filter.

Filter and sub filter are used to specify which registered signature callback object will be used to sign/verify current signature. User could should set filter and sub filter to use default signature callback in Foxit PDF SDK, or use other filter and sub fitler but please ensure that a signature callback object with non-default filter and sub filter should has been registered in Foxit PDF SDK before signing or verifying current signature. Filter and sub filter for default signature callback are:

- filter: "Adobe.PPKLite" and sub filter: "adbe.pkcs7.detached"

- filter: "Adobe.PPKLite" and sub filter: "adbe.pkcs7.sha1"

- filter: "Adobe.PPKLite" and sub filter: "ETSI.CAdES.detached"

- filter: "Adobe.PPKLite" and sub filter: "ETSI.RFC3161"

Parameters

  [in] | filter | String for filter. It cannot be an empty string.

Returns
  None.

## ◆ setImage() [1/2]

void com.foxit.sdk.pdf.Signature.setImage | ( | Image | image,
|  | int | frame_index
| ) |  | throws com.foxit.sdk.PDFException

Set an image for the signature appearance, with a specified frame index.

This function is recommended to be used before calling function Signature.startSign for an unsigned signature. If customized appearance content has been set by function Signature.setAppearanceContent , the image will not be used in signed appearance.
Input image may contain multiple frames, and only one frame of the image can be set to current signature.
If current signature is a time stamp signature, this function will do nothing.

Parameters

  [in] | image | An image. One of its frames will be set to current signature. This image contains at least one frame and the image type should not be com.foxit.sdk.common.Image.e_Unknown .
  [in] | frame_index | Frame index. Valid range: from 0 to (count-1). count is returned by function common.Image.getFrameCount .

Returns
  None.

## ◆ setImage() [2/2]

void com.foxit.sdk.pdf.Signature.setImage | ( | String | file_path,
|  | int | frame_index
| ) |  | throws com.foxit.sdk.PDFException

Set an image for the signature appearance, with a specified frame index.

This function is recommended to be used before calling function Signature.startSign for an unsigned signature. If customized appearance content has been set by function Signature.setAppearanceContent , the image will not be used in signed appearance.
Input image may contain multiple frames, and only one frame of the image can be set to current signature.
If current signature is a time stamp signature, this function will do nothing.

Parameters

  [in] | file_path | A full path of an existing image file. It should not be an empty string.
  [in] | frame_index | Frame index. Valid range: from 0 to (count-1). count is returned by function common.Image.getFrameCount of input image file.

Returns
  None.

## ◆ setKeyLabel()

void com.foxit.sdk.pdf.Signature.setKeyLabel | ( | int | label_name,
|  | String | label_value
| ) |  | throws com.foxit.sdk.PDFException

Set the string for specified key label.

This function is recommended to be used before calling function Signature.startSign for an unsigned signature.
This function is used to set string value for custom label of some key in signature dictionary. If no custom label is set, default labels will be used by Foxit PDF SDK. Please refer to comment of values starting from com.foxit.sdk.pdf.Signature.e_LabelNameSigner for more details.
If current signature is a time stamp signature, this function will do nothing.

Parameters

  [in] | label_name | Key label. Please refer to values starting from com.foxit.sdk.pdf.Signature.e_LabelNameSigner and this should be one of these values.
  [in] | label_value | New string value for key label. If this is an empty string, Foxit PDF SDK will use default label. Please refer to comment of values starting from com.foxit.sdk.pdf.Signature.e_LabelNameSigner for more details.

Returns
  None.

## ◆ setKeyValue()

void com.foxit.sdk.pdf.Signature.setKeyValue | ( | int | key,
|  | String | value
| ) |  | throws com.foxit.sdk.PDFException

Set the string value for specified key name.

This function is recommended to be used before calling function Signature.startSign for an unsigned signature.
This function is used to set string value of some key in signature dictionary, such as signer, reason, location and so on.
If current signature is a time stamp signature, this function will do nothing.

Parameters

  [in] | key | Key name. Please refer to values starting from com.foxit.sdk.pdf.Signature.e_KeyNameSigner and this should be one of these values.
  [in] | value | New string value.

Returns
  None.

## ◆ setSignTime()

void com.foxit.sdk.pdf.Signature.setSignTime | ( | DateTime | sign_time | ) | throws com.foxit.sdk.PDFException

Set time of signing.

This function is recommended to be used before calling function Signature.startSign for an unsigned signature.

Parameters

  [in] | sign_time | The signing time.

Returns
  None.

## ◆ setSubFilter()

void com.foxit.sdk.pdf.Signature.setSubFilter | ( | String | sub_filter | ) | throws com.foxit.sdk.PDFException

Set sub filter.

Filter and sub filter are used to specify which registered signature callback object will be used to sign/verify current signature. User could should set filter and sub filter to use default signature callback in Foxit PDF SDK, or use other filter and sub fitler but please ensure that a signature callback object with non-default filter and sub filter should has been registered in Foxit PDF SDK before signing or verifying current signature. Filter and sub filter for default signature callback are:

- filter: "Adobe.PPKLite" and sub filter: "adbe.pkcs7.detached"

- filter: "Adobe.PPKLite" and sub filter: "adbe.pkcs7.sha1"

- filter: "Adobe.PPKLite" and sub filter: "ETSI.CAdES.detached"

- filter: "Adobe.PPKLite" and sub filter: "ETSI.RFC3161"

Parameters

  [in] | sub_filter | String for sub filter.

Returns
  None.

## ◆ startSign() [1/4]

Progressive com.foxit.sdk.pdf.Signature.startSign | ( | String | cert_path,
|  | byte [] | cert_password,
|  | int | digest_algorithm,
|  | String | save_path,
|  | java.lang.Object | client_data,
|  | PauseCallback | pause
| ) |  | throws com.foxit.sdk.PDFException

Start signing current signature if current signature is unsigned.

This function is used for an unsigned signature. Filter and sub filter keys of current signature specify the name of signature callback object which will be used to sign current signature. So before signing, please ensure current signature has valid filter and sub filter string values. If the filter and sub filter are one of following strings that means to use the default signature callback in Foxit PDF SDK:

- filter: "Adobe.PPKLite" and sub filter: "adbe.pkcs7.detached"

- filter: "Adobe.PPKLite" and sub filter: "adbe.pkcs7.sha1"

- filter: "Adobe.PPKLite" and sub filter: "ETSI.CAdES.detached"

- filter: "Adobe.PPKLite" and sub filter: "ETSI.RFC3161"

For other filter and sub filter or if user wants to use customized signature callback for above filter and sub filter, please ensure a customized signature callback has been registered to Foxit PDF SDK by function common.Library.registerSignatureCallback .
For PDF documents that are compliant with PDF/A specification, common.Library.setDefaultICCProfilesPath is recommended to be called and enable embeding font by calling Signature.enableEmbedFont before calling current function. It may take a long time to sign a signature, so Foxit PDF SDK uses a progressive process to do this.

Parameters

  [in] | cert_path | A full path of a certificate file (including file name and extension), which will be used for signing. This can be an empty string if not necessary in custom signature callback. When this file path is not empty, it should be a valid path. If default signature callback is to be used for signing current signature, this can be a PFX certificate file.
  [in] | cert_password | A password string used to open the cert file. If this is an empty string, that means no password is required.
  [in] | digest_algorithm | The algorithm of message digest for signed data. Please refer to values starting from com.foxit.sdk.pdf.Signature.e_DigestSHA1 and this should be one of these values.
  [in] | save_path | A full PDF file path for saving the signing result. The signed document would be saved to another PDF file.
  [in] | client_data | A user-defined object, which will be passed to call back functions in SignatureCallback . This is useless if the default callback object will be used to sign current signature. Default value: null.
  [in] | pause | Pause object which decides if the signing process needs to be paused. This can be null which means not to pause during the signing process. If this is not null, it should be a valid pause object implemented by user. Default value: null.

Returns
  A progressive object. Please check the rate of current progress by function common.Progressive.getRateOfProgress . If the rate is not 100 yet, call function common.Progressive.resume to continue the progress until the progress is finished.

Note
  This function does not support to save signed PDF document directly to the PDF file which is used to construct the related PDF document of current signature. In order to do so, user is recommended to do as following steps:
  Assume that the related PDF document object is constructed from a PDF file named "org.pdf".

  1. Use current function to save the signed result to an temporary file. Here, this temporary file is named as "temp.tmp".

  2. Ensure that the related PDF document object has destructed – which is equal to "close document".

  3. Remove "org.pdf" and rename "temp.tmp" to "org.pdf".

  Then user can open the signed PDF document to do other operation.

## ◆ startSign() [2/4]

Progressive com.foxit.sdk.pdf.Signature.startSign | ( | StreamCallback | cert_file_stream,
|  | byte [] | cert_password,
|  | int | digest_algorithm,
|  | String | save_path,
|  | java.lang.Object | client_data,
|  | PauseCallback | pause
| ) |  | throws com.foxit.sdk.PDFException

Start signing current signature if current signature is unsigned.

This function is used for an unsigned signature. Filter and sub filter keys of current signature specify the name of signature callback object which will be used to sign current signature. So before signing, please ensure current signature has valid filter and sub filter string values. If the filter and sub filter are one of following strings that means to use the default signature callback in Foxit PDF SDK:

- filter: "Adobe.PPKLite" and sub filter: "adbe.pkcs7.detached"

- filter: "Adobe.PPKLite" and sub filter: "adbe.pkcs7.sha1"

- filter: "Adobe.PPKLite" and sub filter: "ETSI.CAdES.detached"

- filter: "Adobe.PPKLite" and sub filter: "ETSI.RFC3161"

For other filter and sub filter or if user wants to use customized signature callback for above filter and sub filter, please ensure a customized signature callback has been registered to Foxit PDF SDK by function common.Library.registerSignatureCallback .
For PDF documents that are compliant with PDF/A specification, common.Library.setDefaultICCProfilesPath is recommended to be called and enable embeding font by calling Signature.enableEmbedFont before calling current function. It may take a long time to sign a signature, so Foxit PDF SDK uses a progressive process to do this.

Parameters

  [in] | cert_file_stream | A com.foxit.sdk.common.fxcrt.StreamCallback object which is implemented by user to access content of a certificate file which will be used for signing. This can be null if not necessary in custom signature callback. If default signature callback is to be used for signing current signature, a PFX certificate file can be used.
  [in] | cert_password | A password string used to open the cert file. If this is an empty string, that means no password is required.
  [in] | digest_algorithm | The algorithm of message digest for signed data. Please refer to values starting from com.foxit.sdk.pdf.Signature.e_DigestSHA1 and this should be one of these values.
  [in] | save_path | A full PDF file path for saving the signing result. The signed document would be saved to another PDF file.
  [in] | client_data | A user-defined object, which will be passed to call back functions in SignatureCallback . This is useless if the default callback object will be used to sign current signature. Default value: null.
  [in] | pause | Pause object which decides if the signing process needs to be paused. This can be null which means not to pause during the signing process. If this is not null, it should be a valid pause object implemented by user. Default value: null.

Returns
  A progressive object. Please check the rate of current progress by function common.Progressive.getRateOfProgress . If the rate is not 100 yet, call function common.Progressive.resume to continue the progress until the progress is finished.

Note
  This function does not support to save signed PDF document directly to the PDF file which is used to construct the related PDF document of current signature. In order to do so, user is recommended to do as following steps:
  Assume that the related PDF document object is constructed from a PDF file named "org.pdf".

  1. Use current function to save the signed result to an temporary file. Here, this temporary file is named as "temp.tmp".

  2. Ensure that the related PDF document object has destructed – which is equal to "close document".

  3. Remove "org.pdf" and rename "temp.tmp" to "org.pdf".

  Then user can open the signed PDF document to do other operation.

## ◆ startSign() [3/4]

Progressive com.foxit.sdk.pdf.Signature.startSign | ( | String | cert_path,
|  | byte [] | cert_password,
|  | int | digest_algorithm,
|  | StreamCallback | stream_callback,
|  | java.lang.Object | client_data,
|  | PauseCallback | pause
| ) |  | throws com.foxit.sdk.PDFException

Start signing current signature if current signature is unsigned.

This function is used for an unsigned signature. Filter and sub filter keys of current signature specify the name of signature callback object which will be used to sign current signature. So before signing, please ensure current signature has valid filter and sub filter string values. If the filter and sub filter are one of following strings that means to use the default signature callback in Foxit PDF SDK:

- filter: "Adobe.PPKLite" and sub filter: "adbe.pkcs7.detached"

- filter: "Adobe.PPKLite" and sub filter: "adbe.pkcs7.sha1"

- filter: "Adobe.PPKLite" and sub filter: "ETSI.CAdES.detached"

- filter: "Adobe.PPKLite" and sub filter: "ETSI.RFC3161"

For sub filter "ETSI.CAdES.detached" and sub filter "ETSI.RFC3161", please ensure a default time stmap server has been set to TimeStampServerMgr if default signature callbacks for them will be used to do signing. For other filter and sub filter or if user wants to use customized signature callback for above filter and sub filter, please ensure a customized signature callback has been registered to Foxit PDF SDK by function common.Library.registerSignatureCallback .
For PDF documents that are compliant with PDF/A specification, common.Library.setDefaultICCProfilesPath is recommended to be called and enable embeding font by calling Signature.enableEmbedFont before calling current function. It may take a long time to sign a signature, so Foxit PDF SDK uses a progressive process to do this.

Parameters

  [in] | cert_path | A full path of a certificate file (including file name and extension), which will be used for signing. This can be an empty string if not necessary in custom signature callback. When this file path is not empty, it should be a valid path. If default signature callback is to be used for signing current signature, this can be a PFX certificate file.
  [in] | cert_password | A password string used to open the cert file. If this is an empty string, that means no password is required.
  [in] | digest_algorithm | The algorithm of message digest for signed data. Please refer to values starting from com.foxit.sdk.pdf.Signature.e_DigestSHA1 and this should be one of these values.
  [in] | stream_callback | A com.foxit.sdk.common.fxcrt.StreamCallback object which is implemented by user to save the signing result. The signed document would be saved to another PDF file.
  [in] | client_data | A user-defined object, which will be passed to call back functions in SignatureCallback . This is useless if the default callback object will be used to sign current signature. Default value: null.
  [in] | pause | Pause object which decides if the signing process needs to be paused. This can be null which means not to pause during the signing process. If this is not null, it should be a valid pause object implemented by user. Default value: null.

Returns
  A progressive object. Please check the rate of current progress by function common.Progressive.getRateOfProgress . If the rate is not 100 yet, call function common.Progressive.resume to continue the progress until the progress is finished.

Note
  This function does not support to save signed PDF document directly to the PDF file which is used to construct the related PDF document of current signature. In order to do so, user is recommended to do as following steps:
  Assume that the related PDF document object is constructed from a PDF file named "org.pdf".

  1. Use current function to save the signed result to an temporary file. Here, this temporary file is named as "temp.tmp".

  2. Ensure that the related PDF document object has destructed – which is equal to "close document".

  3. Remove "org.pdf" and rename "temp.tmp" to "org.pdf".

  Then user can open the signed PDF document to do other operation.

## ◆ startSign() [4/4]

Progressive com.foxit.sdk.pdf.Signature.startSign | ( | StreamCallback | cert_file_stream,
|  | byte [] | cert_password,
|  | int | digest_algorithm,
|  | StreamCallback | stream_callback,
|  | java.lang.Object | client_data,
|  | PauseCallback | pause
| ) |  | throws com.foxit.sdk.PDFException

Start signing current signature if current signature is unsigned.

This function is used for an unsigned signature. Filter and sub filter keys of current signature specify the name of signature callback object which will be used to sign current signature. So before signing, please ensure current signature has valid filter and sub filter string values. If the filter and sub filter are one of following strings that means to use the default signature callback in Foxit PDF SDK:

- filter: "Adobe.PPKLite" and sub filter: "adbe.pkcs7.detached"

- filter: "Adobe.PPKLite" and sub filter: "adbe.pkcs7.sha1"

- filter: "Adobe.PPKLite" and sub filter: "ETSI.CAdES.detached"

- filter: "Adobe.PPKLite" and sub filter: "ETSI.RFC3161"

For sub filter "ETSI.CAdES.detached" and sub filter "ETSI.RFC3161", please ensure a default time stmap server has been set to TimeStampServerMgr if default signature callbacks for them will be used to do signing. For other filter and sub filter or if user wants to use customized signature callback for above filter and sub filter, please ensure a customized signature callback has been registered to Foxit PDF SDK by function common.Library.registerSignatureCallback .
For PDF documents that are compliant with PDF/A specification, common.Library.setDefaultICCProfilesPath is recommended to be called and enable embeding font by calling Signature.enableEmbedFont before calling current function. It may take a long time to sign a signature, so Foxit PDF SDK uses a progressive process to do this.

Parameters

  [in] | cert_file_stream | A com.foxit.sdk.common.fxcrt.StreamCallback object which is implemented by user to access content of a certificate file which will be used for signing. This can be null if not necessary in custom signature callback. If default signature callback is to be used for signing current signature, a PFX certificate file can be used.
  [in] | cert_password | A password string used to open the cert file. If this is an empty string, that means no password is required.
  [in] | digest_algorithm | The algorithm of message digest for signed data. Please refer to values starting from com.foxit.sdk.pdf.Signature.e_DigestSHA1 and this should be one of these values.
  [in] | stream_callback | A com.foxit.sdk.common.fxcrt.StreamCallback object which is implemented by user to save the signing result. The signed document would be saved to another PDF file.
  [in] | client_data | A user-defined object, which will be passed to call back functions in SignatureCallback . This is useless if the default callback object will be used to sign current signature. Default value: null.
  [in] | pause | Pause object which decides if the signing process needs to be paused. This can be null which means not to pause during the signing process. If this is not null, it should be a valid pause object implemented by user. Default value: null.

Returns
  A progressive object. Please check the rate of current progress by function common.Progressive.getRateOfProgress . If the rate is not 100 yet, call function common.Progressive.resume to continue the progress until the progress is finished.

Note
  This function does not support to save signed PDF document directly to the PDF file which is used to construct the related PDF document of current signature. In order to do so, user is recommended to do as following steps:
  Assume that the related PDF document object is constructed from a PDF file named "org.pdf".

  1. Use current function to save the signed result to an temporary file. Here, this temporary file is named as "temp.tmp".

  2. Ensure that the related PDF document object has destructed – which is equal to "close document".

  3. Remove "org.pdf" and rename "temp.tmp" to "org.pdf".

  Then user can open the signed PDF document to do other operation.

## ◆ startVerify()

Progressive com.foxit.sdk.pdf.Signature.startVerify | ( | java.lang.Object | client_data,
|  | PauseCallback | pause
| ) |  | throws com.foxit.sdk.PDFException

Start verifying the intergrity of current signature if current signature is signed.

This function is used for a signed signature. Filter and sub filter keys of current signature specify the name of signature callback object which will be used to verify current signature. So before verifying, please ensure: the necessary signature callback object has been registered by function common.Library.registerSignatureCallback . If the filter and sub filter of current signed signature are one of following strings that means to use the default signature callback in Foxit PDF SDK and user does not need to register one for them:

- filter: "Adobe.PPKLite" and sub filter: "adbe.pkcs7.detached"

- filter: "Adobe.PPKLite" and sub filter: "adbe.pkcs7.sha1"

- filter: "Adobe.PPKLite" and sub filter: "ETSI.CAdES.detached"

- filter: "Adobe.PPKLite" and sub filter: "ETSI.RFC3161"

It may take a long time to verify a signature, so Foxit PDF SDK uses a progressive process to do this.
From 7.0, this function is only used to verify the intergrity of a signature. To check if a signature is valid or not, please refer to class LTVVerifier .

Parameters

  [in] | client_data | A user-defined object, which will be passed to call back functions in SignatureCallback . This is useless if the default callback object will be used to verify current signature. Default value: null.
  [in] | pause | Pause object which decides if the verifying process needs to be paused. This can be null which means not to pause during the verifying process. If this is not null, it should be a valid pause object implemented by user. Default value: null.

Returns
  A progressive object. Please check the rate of current progress by function common.Progressive.getRateOfProgress . If the rate is not 100 yet, call function common.Progressive.resume to continue the progress until the progress is finished.

## Member Data Documentation

## ◆ e_FieldMDPActionExclude

final int com.foxit.sdk.pdf.Signature.e_FieldMDPActionExclude = 3
| static

Flags of form fields (except specified form fields) will be set read-only.

Note
  "Specified form fields" can be get/set by functions Signature.getFieldMDPActionFields and Signature.setFieldMDPActionFields . Please refer to these functions for more details.

## ◆ e_FieldMDPActionInclude

final int com.foxit.sdk.pdf.Signature.e_FieldMDPActionInclude = 2
| static

Specified form fields' flags will be set read-only.

Note
  "Specified form fields" can be get/set by functions Signature.getFieldMDPActionFields and Signature.setFieldMDPActionFields . Please refer to these functions for more details.

## ◆ e_LabelNameDN

final int com.foxit.sdk.pdf.Signature.e_LabelNameDN = 4
| static

Signature key name for distinguish name.

Note
  Default label name for distinguish name is "DN: " in Foxit PDF SDK.

## ◆ e_LabelNameLocation

final int com.foxit.sdk.pdf.Signature.e_LabelNameLocation = 1
| static

Signature label name for location.

Note
  Default label name for location is "Location: " in Foxit PDF SDK.

## ◆ e_LabelNameProducer

final int com.foxit.sdk.pdf.Signature.e_LabelNameProducer = 6
| static

Signature key name for producer name.

Note
  Default label name for producer name is empty in Foxit PDF SDK.

## ◆ e_LabelNameReason

final int com.foxit.sdk.pdf.Signature.e_LabelNameReason = 2
| static

Signature label name for reason.

Note
  Default label name for reason is "Reason: " in Foxit PDF SDK.

## ◆ e_LabelNameSigner

final int com.foxit.sdk.pdf.Signature.e_LabelNameSigner = 0
| static

Signature label name for signer.

Note
  Default label name for signer is "Digitally signed by " in Foxit PDF SDK.

## ◆ e_LabelNameSignTime

final int com.foxit.sdk.pdf.Signature.e_LabelNameSignTime = 3
| static

Signature label name for sign time.

Note
  Default label name for sign time is "Date: " in Foxit PDF SDK.