XAdES batch signing

What is XAdES batch signing?

XAdES already allows to have multiple files with 1 signature, but XAdES batch signing allows you to get multiple XAdES signatures in one signing session.

XAdES batch signing is very similar to our usual flow, but there are some nuances to be noted:

  1. What methods support XAdES batch signing?
  2. How to prepare for a XAdES batch signing session?
  3. How to get the signatures?

What methods support XAdES batch signing?

Currently, XAdES batch signing is supported by some methods. This means that if you are using our signing preview page, then in the widget you can expect to see less methods than usually. The full list of supported methods can be found at supported signing methods (Check for "Supports batch signing").

How to prepare for a XAdES batch signing session?

So, for example let's prepare 2 XAdES files for signing. Each resulting xml files will have signatures for 2 pdf files digests. To do that in our API request to prepare files for signing we need to do three things:

  1. Set the container_type to "xades".
  2. Add the containerFileName field to each file object in the files array
  3. Set the signature_packaging to "DETACHED" (case-sensitive) because we want to send file digests and have the signature in a separate file.

Important Information about `containerFileName`

  1. The containerFileName field hold the name of the xml file (signature) that will be created after signing.
  2. The containerFileName value must end with .xml.

Sending Request

For that we'll send a POST request to https://id.eideasy.com/api/signatures/prepare-files-for-signing

The request body might look something like this:

{
  "client_id": "{{client_id}}",
  "secret": "{{secret}}",
  "container_type": "xades",
  "signature_packaging": "DETACHED",
  "files": [
    {
      "fileContent": "jezIVxlG1M1woCSUngM6KipUN3/p8cG5RMIPnuEanlE=",
      "fileName": "somefiletest1.pdf",
      "mimeType": "application/pdf",
      "containerFileName": "somefiletest1.xml"
    },
    {
      "fileContent": "jezIVxlG1M1woCSUngM6KipUN3/p8cG5RMIPnuEanlE=",
      "fileName": "somefiletest2.pdf",
      "mimeType": "application/pdf",
      "containerFileName": "somefiletest1.xml"
    },
    {
      "fileContent": "jezIVxlG1M1woCSUngM6KipUN3/p8cG5RMIPnuEanlE=",
      "fileName": "somefiletest3.pdf",
      "mimeType": "application/pdf",
      "containerFileName": "somefiletest2.xml"
    },
    {
      "fileContent": "jezIVxlG1M1woCSUngM6KipUN3/p8cG5RMIPnuEanlE=",
      "fileName": "somefiletest4.pdf",
      "mimeType": "application/pdf",
      "containerFileName": "somefiletest2.xml"
    }
  ]
}

Remember the doc_id returned in response. You can use this to handle webhooks and download signatures via API.

How to get the signatures?

If you want to download the signatures, make a POST request to https://id.eideasy.com/api/signatures/download-signed-file:

{
  "secret": "{{secret}}",
  "client_id": "{{client_id}}",
  "doc_id":"{{doc_id}}"
}

Example response:

{
  "status":"OK",
  "signed_file_contents":"UEsDBBQAAAgAAHI6z06KIflFHwAA",
  "filename":"somefiletest1.xml",
  "signed_files": [
    {
      "name": "somefiletest1.xml",
      "contents": "UEsDBBQAAAgAAHI6z06KIflFHwAA..."
    },
    {
      "name": "somefiletest2.xml",
      "contents": "CCsDBBQAAAgAAHI6z06KIflFHwBB..."
    }
  ]
}
Last Updated: