PadES Preferences
This type of preference is used in method signPades. Their principal options are:
PAdESPreferences |
Name | Type | Mandatory | Default value | Description | Included from SWS version |
---|
hashAlgorithm | String | SHA256 | Algorithm which you want use for sign. Possibile value 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 if you want add or not the timestamp to file signed | outputBase64Encoded | boolean | false | Set to true if you want file signed in Base64 encode | timestampHashAlgo | String | SHA-256 | Algorithm which you want to use during the process of apply 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 | lockFields | List<String> | needAppearanceDisabled | boolean | false | Deprecated | page | 1 | Indicate the page number where you want apply the signature appereance. If you want add the appereance on last page of the PDF, you should set to "-1". | withTimestamp | boolean | false | Set to true if you want 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 for specify the template to be used. (used in old version) | withSignatureField | boolean | false | Set to true if you want apply the signature on signature field in the PDF | SignerImage
The object SignerImage is composed by the following details:
SignerImage |
Name | Type | Mandatory | Default value | Description | Included from SWS version |
---|
image | byte[] | Contains the image which you want apply on the appereance | signerName | String | Contains the text which you want type on the appereance | reason | String | Specify the reason about the signature | textVisible | boolean | true | permits to show or not the text on appereance | textPosition | String | Position of the "signerName" on appereance. Is possible to choose between: | x | int | Coordinate X of the appereance (0 is left of the page) | y | int | Coordinate Y of the appereance (0 is on bottom of the page) | width | int | Specify the width of the appereance | height | int | Specify the height of the appereance | fieldName | Specify the fieldname where apply signature. This fieldName must already exist on PDF file before apply the signature | fontName | String | Times-Roman | Specify the font of the text on appereance to be used. 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 obtain the logo for appereance | imageVisible | boolean | false | permits to show or not the logo on appereance | fontSize | int | 10 | permits to set the fontsize | imageFilename | String | path of the logo on appereance | scaled | boolean | false | Set to true if you want resize the logo on appereance | location | place of signature | Below the example of Pades signature with appereance:
signPadesListWithAppereance.xml
Cades Preferences
With cades signature is possible to sign every type of file, the method signCades require:
- Credentials associated to device signature
- buffer, file which you want sign
- CAdESPreferences, the preferences about CAdES signature
In the following table you can see how set correctly the CAdESPreferences
CAdESPreferences |
Name | Type | Mandatory | Default value | Description | Included from SWS version |
---|
filenameInTSD |
|
|
|
|
|
outputAsTSD |
|
|
|
|
|
outputBase64Encoded | boolean |
| false | Encoded Encodes the file just signed file in base64. |
|
timestampHashAlgo | String |
| SHA-256 | Algorithm which you want to use during the process of apply applying timestamp. |
|
timestampPassword |
|
|
|
|
|
timestampUrl | String |
|
| URL of the timestamp provider with the RFC3161 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 the timestamp credentials. |
|
hashAlgorithm | String | yes | SHA256 | Algorithm which you want to use for signsigning. Possibile value arevalues: SHA1, SHA256, SHA384, SHA512 |
|
level | Level |
| B | See the description of Level type. |
|
withTimestamp | boolean |
| false | counterSignatureIndex Set to true if you want to apply the timestamp after the signature | counterSignature | . |
|
detached | boolean |
| false | Set to true if you want the signature and the files in two different files. The output will be the signature. |
Xades Preferences
With xades signature is possible to sign only XML files, the method signXades require;
- Credentials associated to device signature
- buffer, file which you want sign
- XAdESPreferences, the preferences about XAdES signature
In the following table you can see how set correctly the XAdESPreferences
XAdESPreferences |
Name | Type | Mandatory | Default value | Description | Included from SWS version |
---|
filenameInTSD | outputAsTSD | outputBase64Encoded | boolean | false | Encoded the file just signed in base64 | timestampHashAlgo | String | SHA-256 | Algorithm which you want to use during the process of apply timestamp. | timestampPassword | 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 | hashAlgorithm | String | yes | SHA256 | Algorithm which you want use for sign. Possibile value are: SHA1, SHA256, SHA384, SHA512 | level | Level | B | See the description of Level type | withTimestamp | boolean | false | Set to true if you want apply the timestamp after the signature | detached | boolean | false | Set to true if you want signature and files in two different files. The output will be the signature. | detachedReferenceURI | String | signElement | String | Permits to specify the "Id" on XML which you want sign | signatureId | String | Permits to specify the "Id" of the signature | withoutSignatureExclusion | boolean | false | Permits to sign the file with/without previous signature | XPathQuery | String | Permetis to sign a specified path of XML | Below the example of Xades Signature Level B:
signXadesList-Level-B.txt
Below the example of Xades usign the preferences:
We will sign the parts of XML with "Id=tagToSign" specified on Soap request by:
<signElement>tagToSign</signElement>
And we will set the id of digital signature to:
<signatureId>idOfSignature</signatureId>
The full example:
signXadesList-on-specifiedTagId.xml
Level
You can see how set the correct Level signature:
Level |
Value | Description | Apply on signature | Included from SWS version |
B | in the file signed will be added the electronic signature and the signing certificate | Pades, Cades, Xades | T | Like B-Level, but adds a time-stamp, respectively a time-mark that proves that 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 document time stamp 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 Arichive Time-Stamps) | Pades, Cades, Xades | LTV | (Long Term Validation) contain the OCSP/CRL response after the sign. It is used for validation after the signing certificate has been expired | Pades | How apply the timestamp
Is possible to apply timestamp wit the method "timestamp", in input require:
- content: byte array of file to apply timestamp
- preferences: object with contains details about timestamp
Below the object timestamp:
Name | Type | Mandatory | Default value | Description | Included from SWS version |
---|
filenameInTSD | outputAsTSD | outputBase64Encoded | boolean | false | Encoded the file just signed in base64 | timestampHashAlgo | String | SHA-256 | Algorithm which you want to use during the process of apply timestamp. | timestampPassword | 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 |