The bank public key digest retrieved from the configuration file is wrong when calling fetchFile() from EbicsClient for C54 (actually Z54) order type. In order to fix it, I had to add a very nasty call to bank.setDigests() using KeyUtil.getKeyDigest() to fix the digest on the fly in the method:
public void fetchFile(File file, User user, Product product, OrderType orderType,
boolean isTest, Date start, Date end) throws IOException, EbicsException {
FileTransfer transferManager;
EbicsSession session = createSession(user, product);
// ### FIX THE WRONG BANK PUBLIC KEYS DIGEST ###
EbicsBank bank = session.getUser().getPartner().getBank();
bank.setDigests(KeyUtil.getKeyDigest(bank.getE002Key()), KeyUtil.getKeyDigest(bank.getX002Key()));
// #############################################
session.addSessionParam("FORMAT", "pain.xxx.cfonb160.dct");
if (isTest) {
session.addSessionParam("TEST", "true");
}
transferManager = new FileTransfer(session);
configuration.getTraceManager().setTraceDirectory(
configuration.getTransferTraceDirectory(user));
try {
transferManager.fetchFile(orderType, start, end, file);
} catch (NoDownloadDataAvailableException e) {
// don't log this exception as an error, caller can decide how to handle
throw e;
} catch (Exception e) {
configuration.getLogger().error(
Messages.getString("download.file.error", Constants.APPLICATION_BUNDLE_NAME), e);
throw e;
}
}
It would be great to have a better solution if possible?
The bank public key digest retrieved from the configuration file is wrong when calling
fetchFile()
fromEbicsClient
for C54 (actually Z54) order type. In order to fix it, I had to add a very nasty call tobank.setDigests()
usingKeyUtil.getKeyDigest()
to fix the digest on the fly in the method:It would be great to have a better solution if possible?