Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Add Document Digest

Scope

Purpose of the "Add document digest" operation is to avoid file transfering (if there is extra security requirements) out of internal network.

Operation add signable file digest (HASH) and filename to the file processing session.

Only possible for signing ASICE (EDOC) document types.

Description

1. The file digest and file name is attached to the file processing session;
2. The file description information is returned.

Request

The Service provider's application sends the following GET request using TLS:

Code Block
POST /api-storage/v1.0/{sessionId}/addDocumentDigest 


PropertyTypeUsageDescription
sessionId
String (64)MandatoryFile processing session identifier

Include Page
Tip - SignAPI Introspect access token
Tip - SignAPI Introspect access token

Body

Code Block
{
    "files": [
            {
                "name": {String},
                "digest": {String},
				"digest_algorithm": {String}
            }
        ],
    "signatureIndex": {String}
}

Pagebreak

PropertyTypeUsageDescription
files
Array
MandatoryFile digest and name array
files.name
String
MandatoryThe name of the file (with extension) from which the diggest was calculated
files.digest
String
MandatoryCalculated file digest in Base64 encoding. (warning) See note below.
files.digest_algorithm
String
MandatoryUsed HASH Algorithm (Only SHA256 is supported)
signatureIndex
String
Optional

Signature sequence index, starting with "0", which means the first signature (XAdES signature file name signatures0.xml)

If Property is not used, signature index will be "0".

(warning) If there is planed that file will be signed by more than one signer, this parameter shall be used by increasing by 1 for each next signature. ASICE container can't contain more then one signature with same file name.

Otherwise, service provider shall rename signature file before adding it to ASICE container.


Note
titleFile diggest calculation

(warning) Only SHA256 at this moment is supported.

(lightbulb) Fist calculate SHA256 HASH from the file you need to sign. Then take SHA256 HASH and make HEX to Base64 encoding. For example encoding you can use https://base64.guru/converter/encode/hex


Tip


Expand
titleGuidelines for using file digest till ASICE finalizing.

Include Page
TIP - SignAPI Digest signing
TIP - SignAPI Digest signing


Example with one file digest and name

Code Block
POST /api-storage/v1.0/77740b301f0880ef498cb1e474e8060b3e538cfeea8ebf508c2bad4b72b56a87/addDocumentDigest HTTP/1.1
Authorization: Bearer a477b3a3366768c07e4c458f518711b4b351e8d2c2f0f78a1524e4d3efd00603
Host: signapi-prep.eparaksts.lv
{
    "files": [
            {
                "name": "10-10.pdf",
                "digest": "u69UTpGwlSfNpIMYhXPIa612ELFu+Y8zWaVCApzlQdE=",
				"digest_algorithm": "SHA256"
            }
        ],
    "signatureIndex": "0"
}

Pagebreak

Example with multiple file digest and name

Code Block
POST /api-storage/v1.0/77740b301f0880ef498cb1e474e8060b3e538cfeea8ebf508c2bad4b72b56a87/addDocumentDigest HTTP/1.1
Authorization: Bearer a477b3a3366768c07e4c458f518711b4b351e8d2c2f0f78a1524e4d3efd00603
Host: signapi-prep.eparaksts.lv
{
    "files": [
            {
                "name": "10-10.pdf",
                "digest": "u69UTpGwlSfNpIMYhXPIa612ELFu+Y8zWaVCApzlQdE=",
				"digest_algorithm": "SHA256"
            },
            {
                "name": "10-11.docx",
                "digest": "u69UTpGwlSfNpIMYhXPIa612ELFu+Y8zWaVCApzlQdB=",
				"digest_algorithm": "SHA256"
            },
            {
                "name": "10-12.pdf",
                "digest": "u69UTpGwlSfNpIMYhXPIa612ELFu+Y8zWaVCApzlQdC=",
				"digest_algorithm": "SHA256"
            }
        ],
    "signatureIndex": "0"
}

Response

JSON object:

Code Block
{
    "data": [
        {
            "id": {String},
            "name": {String},
            "size": {Number},
			"type": {String}
        }
    ]
}


PropertyTypeDescription
data
Object
Data Object
data.id
String
File Identifier (documentId)
data.name
String
File name
data.size
Integer
File size in bytes (always will be "0" since filename and digest was added)
data.type
String

Processed file type:

"hash" - In case if file digest and file name is added to session

Example if one file digest and name

Code Block
{
    "data": [
        {
            "id": "6921c9e8afd22a9a391d5318e08da85d",
            "name": "10-10.pdf",
            "size": 0,
			"type": "hash"
        }
    ]
}

Example if multiple file digest and name is added

Code Block
languagejava
{
    "data": [
        {
            "id": "6921c9e8afd22a9a391d5318e08da85d",
            "name": "10-10.pdf",
            "size": 0,
			"type": "hash"
        },
        {
            "id": "9f1702526028570f5f6c2813417797a0",
            "name": "10-11.docx",
            "size": 0,
			"type": "hash"
        },
        {
            "id": "5d05429bc930622ee008ed4ded1b2de1",
            "name": "10-12.pdf",
            "size": 0,
			"type": "hash"
        }
    ]
}