Calculate Digest
Scope
Provide a signable data value calculation from the signable file by using the end-user signature certificate received.
Description
1. Start signing session. If there are problems with the files or the request does not meet the format requirements for the document signing, the process is terminated and an error is returned;
2. The hash of each file to be signed are calculated as well as signable data;
3. The signature algorithm is determined from certificate;
4. The prepared signable data in base64 format is returned to the requester for signature.
Request
The Service provider's application sends the following GET request using TLS:
POST /api-sign/v1.0/CalculateDigest
Authorization
The request must contain an Authorization header with an OAuth Introspect access token obtained via Integration Platform a Service provider's credentials grant flow.
Body
{ "sessions":[ { "sessionId": "string" } ], "certificate": "string", "signAsPdf": true, "createNewEdoc": true }
Property | Description |
---|---|
sessions | Information about file processing sessions |
sessions.sessionId | File processing session identifier. It is possible to specify multiple sessions. |
certificate | Signing certificate in base64 format |
signAsPdf | True - will be signed as PDF (can only be used for signing PDFs and only one PDF file per session). In this case, the propery "createNewEdoc" will be ignored.False - will create XAdES signature in ASICE container (EDOC). |
createNewEdoc |
False - If existing file is ASICE container, new signature will be added within existing ASICE container. If file is not ASICE, it will be added in ASICE container. |
Example of single session signing
POST /api-sign/v1.0/CalculateDigest HTTP/1.1 Authorization: Bearer a477b3a3366768c07e4c458f518711b4b351e8d2c2f0f78a1524e4d3efd00603 Host: signapi-prep.eparaksts.lv { "sessions": [ { "sessionId": "fefdaec2b14bf2977d32a861fb49545244c654f7a4736dcc081ae1857a3a3dd4" } ], "certificate": "MIIG/j.......<sign certificate base64 here>.......xFP/IP==", "signAsPdf": false, "createNewEdoc": false }
Example of batch session signing
POST /api-sign/v1.0/CalculateDigest HTTP/1.1 Authorization: Bearer a477b3a3366768c07e4c458f518711b4b351e8d2c2f0f78a1524e4d3efd00603 Host: signapi-prep.eparaksts.lv { "sessions": [ { "sessionId": "fefdaec2b14bf2977d32a861fb49545244c654f7a4736dcc081ae1857a3a3dd4" }, { "sessionId": "fefdaec2b14bf2977d32a861fb49545244c654f7a4736dcc081ae18512121212" }, { "sessionId": "fefdaec2b14bf2977d32a861fb49545244c654f7a4736dcc081ae185bbbbbbbb" } ], "certificate": "MIIG/j.......<sign certificate base64 here>.......xFP/IP==", "signAsPdf": false, "createNewEdoc": false }
Response
JSON object:
{ "sessionDigests":[ { "sessionId": "string", "digest": "string", "error": { "code": "string", "message": "string" } } ], "digests_summary": "string", "algorithm": "string" }
Property | Description |
---|---|
sessionDigest | Information about signable data session |
sessionDigest.sessionId | File processing session identifier |
sessionDigest.diggest | Signable data in base64 format In case of server signing - received " In case of signing with Smart Card by using LVRTC provided browser extension integration, then this value shall be converted to HEX. |
sessionDigests.error | Session error if any |
sessionDigests.error.code | Session error code |
sessionDigests.error.message | Session error message |
digests_summary |
It is already precalculated digest summary. In case of server signing - " |
algorithm | Algorithm of the digital signature |
Example of single session signing
{ "data": { "sessionDigests": [ { "sessionId": "a37e460b4c65cb01a01dce5c58149806ca2d20dab22e99905d45128c4e693a90", "digest": "4xZX5G+R4gTbK2r6RlismZw4EBftvbSDcE3lXfpLMM4=" } ], "digests_summary": "mnF3XVRWujh/Tsc3oA2HVGl0SI8VNb3pmscMcDhEzDo=", "algorithm": "SHA256" } }
Example of batch session signing
{ "data": { "sessionDigests": [ { "sessionId": "fefdaec2b14bf2977d32a861fb49545244c654f7a4736dcc081ae1857a3a3dd4", "digest": "wRX+DNmDdlDrMK8X/MEdersGZbsgTiSFHi26domxjwA=" }, { "sessionId": "fefdaec2b14bf2977d32a861fb49545244c654f7a4736dcc081ae18512121212", "digest": "wRX+DNmDdlDrMK8X/MEdersGZbsgTiSFHi26domxjwA=" }, { "sessionId": "fefdaec2b14bf2977d32a861fb49545244c654f7a4736dcc081ae185bbbbbbbb", "digest": "wRX+DNmDdlDrMK8X/MEdersGZbsgTiSFHi26domxjwA=" } ], "digests_summary": "mnF3XVRWujh/Tsc3oA2HVGl0SI8VNb3pmscMcDhEzDo=", "algorithm": "SHA256" } }