open-eid / digidoc4j

DigiDoc for Java. Javadoc:
http://open-eid.github.io/digidoc4j
GNU Lesser General Public License v2.1
73 stars 39 forks source link

Not using singleton configuration #100

Closed MarkoPomerants closed 3 years ago

MarkoPomerants commented 3 years ago
[https-openssl-nio-8443-exec-24] INFO org.digidoc4j.impl.asic.AsicContainer - Container was saved to stream
[https-openssl-nio-8443-exec-21] INFO org.digidoc4j.impl.ConfigurationSingeltonHolder - Using existing configuration instance
INFO eu.europa.esig.dss.tsl.job.TLValidationJob - Online refresh is running...

This function loads TSL every time: dataToSign.finalize(signatureValue);

How can I use previously loaded TSL conf with it?

rsarendus commented 3 years ago

DataToSign::finalize(byte[]) should not trigger loading the TSL again when re-using the same Configuration instance which already has the TSL loaded, unless the loaded TSL has expired.

For more information, see TSL loading and pre-loading. In case of using the central configuration object singleton, pre-loading can be done as follows:

ConfigurationSingeltonHolder.getInstance().getTSL().refresh();

What might cause TSL to load every time DataToSign::finalize(byte[]) is called, is if an instance of DataToSign (which has a reference to an instance of Configuration) is serialized, then deserialized and then finalize(byte[]) is called on the deserialized object (which now contains its own separate instance of Configuration).

MarkoPomerants commented 3 years ago

Thanks.

It turns out it was the serialized DataToSign, which had it's own Configuration instance.