Skip to content

Using test TSL lists

Risto Seene edited this page May 26, 2022 · 4 revisions

In testing environment, it is possible to use test TSL lists for validating signatures that have been created with test certificates.

Setup options for using test TSL

You can specify the LOTL that is used by the library either in the digidoc4j.yaml configuration file or directly via the API.

digidoc4j.yaml configuration file

Set the TSL_LOCATION configuration parameter to refer to the test LOTL location. Since version 5.0.0 the old configuration parameter is deprecated and using LOTL_LOCATION is preferred:

# pre-5.0.0 DigiDoc4J (deprecated since 5.0.0)
TSL_LOCATION: https://open-eid.github.io/test-TL/tl-mp-test-EE.xml
# since DigiDoc4J version 5.0.0
LOTL_LOCATION: https://open-eid.github.io/test-TL/tl-mp-test-EE.xml

Configure the trust-store that contains the signing certificate for the test LOTL. Since version 5.0.0 the old configuration parameters prefixed with TSL_ are deprecated and using the new parameters prefixed with LOTL_ is preferred:

# pre-5.0.0 DigiDoc4J (deprecated since 5.0.0)
TSL_KEYSTORE_LOCATION: keystore/test-keystore.jks
TSL_KEYSTORE_PASSWORD: digidoc4j-password
# since DigiDoc4J version 5.0.0
LOTL_TRUSTSTORE_PATH: classpath:truststores/test-lotl-truststore.p12
LOTL_TRUSTSTORE_PASSWORD: digidoc4j-password
LOTL_TRUSTSTORE_TYPE: PKCS12

API

Set the test LOTL location via the setTslLocation method of the Configuration class. Since version 5.0.0 the old method is deprecated and using setLotlLocation is preferred:

Configuration configuration = Configuration.of(Configuration.Mode.TEST);
// pre-5.0.0 DigiDoc4J (deprecated since 5.0.0)
configuration.setTslLocation("https://open-eid.github.io/test-TL/tl-mp-test-EE.xml");
// since DigiDoc4J version 5.0.0
configuration.setLotlLocation("https://open-eid.github.io/test-TL/tl-mp-test-EE.xml");

Configure the trust-store that contains the signing certificate for the test LOTL. Since version 5.0.0 the old methods prefixed with setTsl are deprecated and using the new methods prefixed with setLotl is preferred:

// pre-5.0.0 DigiDoc4J (deprecated since 5.0.0)
configuration.setTslKeyStoreLocation("keystore/test-keystore.jks");
configuration.setTslKeyStorePassword("digidoc4j-password");
// since DigiDoc4J version 5.0.0
configuration.setLotlTruststorePath("classpath:truststores/test-lotl-truststore.p12");
configuration.setLotlTruststorePassword("digidoc4j-password");
configuration.setLotlTruststoreType("PKCS12");

NB: In older versions of DigiDoc4J, only JKS keystores were supported as LOTL truststores. Since DigiDoc4J version 5.0.0, the type of LOTL truststores can be specified explicitly.