Skip to content

Wrong bank public key digest at fetchFile #26

Closed

Description

@cyrilfr

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?

Activity

  1. uwemaurer commented on Nov 19, 2025

    @uwemaurer
    Collaborator

    Closing this issue as it’s old and the project has moved on (EBICS 3.0). Feel free to reopen if it’s still relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions