PadES Preferences
This type of preference is used in method signPades. Their main options are:
PAdESPreferences |
Name | Type | Mandatory | Default value | Description | Included from SWS version |
---|
hashAlgorithm | String | SHA256 | Algorithm you want to use for signature. Possible values are: SHA1, SHA256, SHA384, SHA512. | level | Level | B | See the description of Level type. | signType | int | encryptInAnyCase | boolean | false | filenameInTSD | String | Not used. | outputAsTSD | boolean | Not used. | withTimestamp | boolean | false | Specify wheater you want to add the timestamp to the signedfile or not,outputBase64Encoded | boolean | false | Set true if you want the file signed in Base64 encoding. | timestampHashAlgo | String | SHA-256 | Algorithm you want to use during the process of applying timestamp. | timestampUrl | String | URL of timestamp provider with standard RFC3161. Namirial URL: PROD: https://timestamp.namirialtsp.com / http://timestamp.namirialtsp.com TEST: https://timestamp.test.namirialtsp.com / http://timestamp.test.namirialtsp.com | timestampUsername | String | Username of timestamp credentials. | timestampPassword | String | Password of timestamp credentials. | needAppearanceDisabled | boolean | false | Deprecated. | page | 1 | Indicate the page number on which you want to apply the signature appearance. If you want to add the appearance on the last page of the PDF file, you should set it to "-1". | withTimestamp | boolean | false | Set true if you want to apply the timestamp after the signature. | encryptionPassword | String | Specify the password PDF, if present. | lockFields | List<String> | signerImage | SignerImage | See the description of SignerImage. | signerImageReference | String | Used to specify the template to be used. (used in old version) | withSignatureField | boolean | false | Set true if you want to apply the signature on signature field in the PDF file. | SignerImage
The SignerImage object is composed of the following:
SignerImage |
Name | Type | Mandatory | Default value | Description | Included from SWS version |
---|
image | byte[] | Contains the image you want to apply to the appearance. | signerName | String | Contains the text you want to type to the appearance. | reason | String | Indicate the reason for the signature. | textVisible | boolean | true | Allows the text to be shown on appearance or not. | textPosition | String | Position of the "signerName" on appearance. It is possible to choose between: | x | int | X coordinate of the appearance (0 is on left of the page). | y | int | Y coordinate of the appearance (0 is on bottom of the page). | width | int | Specify the width of the appearance. | height | int | Specify the height of the appearance. | fieldName | Specify the fieldname to which the signature is to be applied. This fieldName must already exist in the PDF file before the signature is applied. | fontName | String | Times-Roman | Specify the font to be used for the text on the appearance. The possible values are: - Times-Roman
- Times-Bold
- Times-Italic
- Times-BoldItalic
- Helvetica
- Helvetica-Bold
- Helvetica-Oblique
- Helvetica-BoldOblique
- Courier
- Courier-Bold
- Courier-Oblique
- Courier-BoldOblique
- Symbol
- ZapfDingbats
| fontName | String | Specify the ttf path which contain custom font. | 2.5.39 | imageURL | String | URL to get the logo for appearance. | imageVisible | boolean | false | Allows the logo to be displayed or not when it appears. | fontSize | int | 10 | Allows the fontsize to set set. | imageFilename | String | Path of the logo on appearance. | scaled | boolean | false | Set true if you want to resize the logo on appearance. | location | Place of the signature. | Below the example of Pades signature with appearance:
signPadesListWithAppereance.xml
Cades Preferences
With cades signature, it is possible to sign each type of file. The signCades method requires:
- Credentials assigned to device signature;
- Buffer, the file that you want to sign;
- CAdESPreferences, the preferences about CAdES signature.
In the following table, you can see how to set the CAdESPreferences correctly:
CAdESPreferences |
Name | Type | Mandatory | Default value | Description | Included from SWS version |
---|
filenameInTSD | outputAsTSD | outputBase64Encoded | boolean | false | Encodes the just signed file in base64. | timestampHashAlgo | String | SHA-256 | Algorithm you want to use during the process of applying timestamp. | timestampPassword | timestampUrl | String | URL of the timestamp provider with the RFC3161 standard. Namirial URL: PROD: https://timestamp.namirialtsp.com / http://timestamp.namirialtsp.com TEST: https://timestamp.test.namirialtsp.com / http://timestamp.test.namirialtsp.com | timestampUsername | String | Username of the timestamp credentials. | hashAlgorithm | String | yes | SHA256 | Algorithm which you want to use for signing. Possible values: SHA1, SHA256, SHA384, SHA512. | level | Level | B | See the description of Level type. | withTimestamp | boolean |
| false | Set true if you want to apply the |
timestamp after the signature.counterSignature | counterSignatureIndex | detached | boolean | false | Set true if you want the signature and the files in two different files. The output will be the signature. | Xades Preferences
With Xades Signature it is possible to sign only XML files, the signXadesmethod requires:- Credentials assigned to device signature
- Buffer, file that you want to sign
- XAdESPreferences, the preferences about XAdES signature
In the following table you can learn how to set the XAdESPreferences correctly:
XAdESPreferences |
Name | Type | Mandatory | Default value | Description | Included from SWS version |
---|
filenameInTSD | outputAsTSD | outputBase64Encoded | boolean | false | Encodes the just signed file in base64. | timestampHashAlgo | String | SHA-256 | Algorithm you want to use during the process of applying timestamp. | timestampPassword | timestampUrl | String | URL of the timestamp provider with the RFC3161 standard. Namirial URL: PROD: https://timestamp.namirialtsp.com / http://timestamp.namirialtsp.com TEST: https://timestamp.test.namirialtsp.com / http://timestamp.test.namirialtsp.com | timestampUsername | String | Username of the timestamp credentials. | hashAlgorithm | String | yes | SHA256 | Algorithm you want to use for signing. Possibile values: SHA1, SHA256, SHA384, SHA512 | level | Level | B | See the description of Level type. | withTimestamp | boolean | false | Set true if you want to apply the timestamp after the signature. | detached | boolean | false | Set true if you want the signature and the files in two different files. The output will be the signature. | detachedReferenceURI | String | signElement | String | Allows to specify the "Id" on XML which you want to sign. | signatureId | String | Allows to specify the "Id" of the signature. | withoutSignatureExclusion | boolean | false | Allows to sign the file with/without previous signature. | XPathQuery | String | Allows to sign a specified path of XML | Below is the example of Xades Signature Level B:
signXadesList-Level-B.txt
Below, there is an example of Xades using the preferences:
We sign the XML parts with "Id=tagToSign" specified on Soap request by:
<signElement>tagToSign</signElement>
And we set the id of the digital signature to:
<signatureId>idOfSignature</signatureId>
The full example:
signXadesList-on-specifiedTagId.xml
Level
You can see how to set the correct Level signature:
Level |
Value | Description | Apply on signature | Included from SWS version |
B | In the signed file the electronic signature and the signing certificate are added. | Pades, Cades, Xades | T | Like B-Level, but adds a time-stamp, respectively a time-mark that proves the signature existed at a certain date and time. | Pades, Cades, Xades | LT | Like T-Level, but adds VRI (Verification Related Information) data to the DSS (Long Term). | Pades, Cades, Xades | LTA | Like LT-level, but adds a timestamp document and VRI data for the TSA (Time Stamping Authority). An LTA may help to validate the signature beyond any event that may limit its validity (Long Term with Archive Time-Stamps).Pades, Cades, Xades | signature on signature field in the PDF file. |
|