Instructions for DigiDocService service users on how to migrate to BDOC format

When migrating to BDOC file format it's necessary to decide if you want to use BDOC-TM (BDOC with timemark) or BDOC-TS ie ASiC- E (BDOC with timestamp) signature format in your system. We recommend BDOC-TS format for services that require for the signed files to be internationally compatible. BDOC-TM format is mostly meant for domestic use. The BDOC transition schedule can be found here.

The BDOC file format usage differences have also been described in the DigiDocService service documentation method descriptions.
NB! DigiDocService version 3.7 only supports BDOC-TM file format. MobileCreateSignature method will get BDOC-TS file format support in Ferbruary 2015 and other methods will follow in April 2015.
1. Transition if you are using DigiDocService PHP client library.
PHP client libary users should start using new BDOC and relevant PHP client library.  Besides new client library there is also a sample application. Information regarding new client libary and sample application can be found here.
2. Transition if you are not using PHP client library and you start DigiDocService service session with StartSession method.
2.1 Transition when you send a perviously created BDOC container to the service. 
BDOC container transmitted in SigDocXML parameter with StartSession query has to be base64-encoded before being sent to the service.  When using MobileSign and PrepareSignature signing methods it's possible to define with SigningProfile paramater if the signature will be in BDOC-TM or BDOC-TS format. "LT_TM" is the label for BDOC-TM signature profile and "LT" for BDOC-TS signature profile. The BDOC file that is returned from the service by GetSignedDoc method is base64-encoded and has to be base64-decoded before saving. 
Otherwise, the use of the service will take place in exactly the same way as for DDOC containers. 
When datafile contents are not sent to the service it is possible to transform BDOC containers to hashcode like with DDOC. This transformation has been described in DigiDocService documentation in chapter Transforming a BDOC container to HASHCODE form .
2.2 Transition when new BDOC container creation is done inside DigiDocService service.
Since default container format for StartSession query is DDOC, then to use BDOC format you should do the following:
  1. Make StartSession method query without parameter to the DigiDocService service.
  2. Then call out CreateSignedDoc method with following parameters:
    1. Format value should be “BDOC”
    2. Version value should be “2.1”
  3. Now add desired datafiles to the container using AddDataFile method. 
Adding signatures to the container is done the same way as with DDOC file format. The only difference is that when using MobileSign and PrepareSignature methods it's possible to define file format during signing to either BDOC-TM or BDOC-TS with SigningProfile parameter.  "LT_TM" is the label for BDOC-TM signature profile and "LT" for BDOC-TS signature profile. 
The BDOC file that is returned from the DigiDocService service by GetSignedDoc method is base64-encoded and has to be base64-decoded before saving. 
2. Transition when you are only using DigiDocService web service for signing with Mobiil-ID and MobileCreateSignature method.
When using BDOC file format with MobileCreateSignature method it's required to use the following parameter values: 
  • Format value should be “BDOC”
  • Version value should be “2.1”
  • SigningProfile parameter allows defining the BDOC file format. "LT_TM" is the label for BDOC-TM signature profile and "LT" for BDOC-TS signature profile.
  • Datafiles -> MimeType parameter should have the same value as datafile mime-type. It's important that the MimeType sent to the service matches the mime-type in the container manifest.xml. In addition to the signature XML the mime-type is also defined in BDOC container manifest.xml file. 
  • Datafiles -> DigestType value should be “sha256”
  • Datafiles -> DigestValue value should be datafile SHA256 hash in base64 from datafile binary form.
When these parameter values are used, then the returned signature XML with MobileCreateSignature method is BDOC compatible. During container creation it's important to remember that BDOC and DDOC container creation is different. 
If you are using DigiDoc libraries for container creation, then you should start using a library that supports BDOC format.  Instructions on how JDigiDoc library users can migrate to BDOC format can be found here.
If you are creating the container yourself then the information regarding container structure can be found in the BDOC file format description. NB! We strongly recomment testing the created containers with the newest version of DigiDoc3 client to ensure that there are no mistakes. 



If you didn't find an answer to your question, send it to our team.

  • See instructions
  • Please estimate your ability to use the computer, so that we can provide you with the best guidance


  • Verification failed

How can we improve the article and be more helpful?
Send Close