Big inteface
Introduction
SWS provides REST interface for Pades and Cades signatures for very large files (you can sign files over 1GB). Without any problem with appliance memory as it handles files with a stream.
At this link:
http://<IP-APPLIANCE>:8080/SignEngineWeb/rest/service
You can find this two method:
signPAdES
signCAdES
signPAdES
Below is the example of signPAdES request with CURL:
curl --form 'credentials="{\"username\":\"DEVICENAME\",\"password\":\"PASSWORD\"}";type=application/json' --form 'preferences="{\"page\":\"1\",\"hashAlgorithm\":\"SHA256\", \"withTimestamp\": \"false\"}";type=application/json' --form file=@FILE_TO_BE_SIGNED.pdf --request POST http://<IP-APPLIANCE>:8080/SignEngineWeb/rest/service/signPAdES --output FILE_SIGNED.pdf
In this example, we are signing the file: "FILE_TO_BE_SIGNED.pdf" and the file signed will be saved in "FILE_SIGNED.pdf".
signCAdES
Below is the example of signCAdES with CURL:
curl -X POST http://<IP-APPLIANCE>:8080/SignEngineWeb/rest/service/signCAdES --form "credentials=@credentials.json;type=application/json" --form "preferences=@cadesPreferences.json;type=application/json" --form file="@File_to_sign.pdf" -o "File_signed.pdf.p7m"
In this example, we are signing the file: "File_to_sign.pdf" and the file signed will be saved in "File_signed.pdf.p7m"
At this link, you can download the preferences and the credentials used.
Verify CAdES (available from version 3.0.4)
This method allow to verify ONLY cades signatures, below the curl:
curl -X POST http://<IP-APPLIANCE>:8080/SignEngineWeb/rest/service/verifyCades --form file=@"signed.pdf.p7m" --form preferences=@"verify_preferences.json" -o reportVerify.json
In this example we are verifying the file “signed.pdf.p7m” and the verify report will be displayed on file “reportVerify.json”
The json with preferences in input is OPTIONAL, and the default languange in “EN”, below the file “verify_preferences.json” used in curl:
{
"language": "it",
"verifyOnDate": "2025-03-26T10:58:47.594+00:00"
}
Our advise is set only set language
Extract plain document from cades signature (available from version 3.0.4)
This method allow to extract the original document from cades signature, below the curl:
curl -X POST http://localhost:8080/SignEngineWeb/rest/service/extractPlainDocumentCades --form file=@"signed.pdf.p7m" -o plainDocument.pdf
“signed.pdf.p7m” → contains the cades file
“plainDocument.pdf” → specify the filename associated to original document
Technical Configurations
By Default, you can sign until 1GB without add customization, but if you want sign files over 1GB, you must add customization properties
If you are using a Docker distribution, you must add this property in run command:
-e SPRING_SERVLET_MULTIPART_MAX_REQUEST_SIZE=@MAX_REQUEST@GB -e SPRING_SERVLET_MULTIPART_MAX_FILE_SIZE=@MAX_MULTIPART@GB
Where you can replace this placeholder:
MAX_MULTIPART -> is the max file size you want sign in GB (our advise is greater than the file size you want sign)
MAX_REQUEST -> is the max file of request (should be at the least the value of MAX_REQUEST)
For example if you want sign a file of 3GB, you can use this value:
MAX_REQUEST = 5
MAX_MULTIPART = 4
And the properties of docker run run will be:
docker run ... -e SPRING_SERVLET_MULTIPART_MAX_REQUEST_SIZE=5GB -e SPRING_SERVLET_MULTIPART_MAX_FILE_SIZE=4GB
IMPORTANT: the disk free space must be at least a double of MAX_MULTIPART value, in the above, you should have at least 10GB free