libfintx icon indicating copy to clipboard operation
libfintx copied to clipboard

Nachricht ungueltig.:Validierung fehlgeschlagen with DKB in current version

Open korneliuscode opened this issue 2 years ago • 17 comments

I get an error with DKB on the most current version. Right with synchronization:

HNHBK:1:3+000000000137+300+0+1+0:1'
HIRMG:2:2+9010::Nachricht ungueltig.:Validierung fehlgeschlagen.+9800::Dialog abgebrochen'
HNHBS:3:1+1'

This is the trace of the sent message.

HNSHA:6:2+2146045886951968++XXXXXX'
HNHBK:1:3+000000000407+300+0+1'
HNVSK:998:3+PIN:1+998+1+1::0+1:20211211:140736+2:2:13:@8@00000000:5:1+280:12030000:XXXXXXXX:V:0:0+0'
HNVSD:999:1+@246@HNSHK:2:4+PIN:1+999+2146045886951968+1+1+1::0+1+1:20211211:140736+1:999:1+6:10:16+280:12030000:XXXXXXXX:S:0:0'
HKIDN:3:2+280:12030000+XXXXXXXX+0+1'
HKVVB:4:3+0+0+0+9FA6681DEC0CF3046BFC2F8A6+1.0.0'
HKSYN:5:3+0'
HNSHA:6:2+2146045886951968++XXXXXXXXXXX''
HNHBS:7:1+1'

Does anyone have an idea what this could be?

korneliuscode avatar Dec 11 '21 13:12 korneliuscode

There is an error in the message creation. In line 705 and 726 in FinTsMessage.cs a StringBuilder is reused which results in a faulty message.

But even if I fix that I'm running into other issues later when trying the get the account balance.

leschbenedikt avatar Dec 23 '21 06:12 leschbenedikt

I see the same issue with the latest version. But probably there is also something else:

  • Until some days I used an much older version, I think it was from april 21, without any problems...

  • Since beginning of 2022 I think DKB changed something and I got error message (with older version) like: Initialisation failed: 9050: Die Nachricht enthält Fehler., 3905: Es wurde keine Challenge erzeugt., 9800: Dialog abgebrochen, 3920: Zugelassene Zwei-Schritt-Verfahren für den Benutzer.:921, 9955: Auftrag nicht ausgeführt - Die Gerätebezeichnung ist unbekannt. (MBV07390100255)

@leschbenedikt Is this something you see after your fix?

Anyone else available to look into the DKB issue? I'll try to have a more detailed look within the next days at least to reproduce the old error message, but I am not really familiar with this bank communication stuff...

party-pansen avatar Jan 04 '22 20:01 party-pansen

Ich habe versucht die Library upzudaten. Scheinbar ist mir hier ein Fehler unterlaufen. Die Bibliothek benötigt jedoch ein komplettes Redesign/Refactoring.

thisistorsten avatar Jan 05 '22 22:01 thisistorsten

@party-pansen I just checked my local code, the only othes changes I found were in HKKAZ.cs But the change is only related to transaction retrieval. I'm not sure what use case your are talking about.

But anyway this are the changes:

At first I added the segment Id to the call in line 147 segments = HKTAN.Init_HKTAN(client, segments, "HKKAZ");

In addition I replace every client.HICAZS with client.HIKAZS like in the commented rows below. But if I remenber it correctly this resolved problems with one bank but had issues with other banks. Maybe you try the first change at first and only try the second one if it's still not working.

leschbenedikt avatar Jan 06 '22 14:01 leschbenedikt

Ok, I had some time to analyse:

There is a major bug in the new implementation as you already pointed out:
In line 705 and 726 in FinTsMessage.cs the following line needs to be added:
sb = new StringBuilder();

After that I get back to my original error message regarding "9955: Auftrag nicht ausgeführt - Die Gerätebezeichnung ist unbekannt."

After some research I found the following article: https://medium.com/@subsembly/leitfaden-deutsche-kreditbank-dkb-bbd2d23fb6b9

So there was indeed an issue with my TAN devices which I could solve online @ DKB by removing a second, old pushTan device...

Back to the program, it still did not work. I needed to provide a pushtan, but the generated HKTAN message has failures: HIRMG:3:2+9050::Die Nachricht enthält Fehler.+9800::Dialog abgebrochen+9000::Konvertierung in das/aus dem Format des Verarbeitungssystems fehlgeschlagen.'

Luckily I had an old trace which gave me a hint on the bug. It's simple: Just uncomment line 151 from Tan.cs That's again a bug when switching to sb.Append from old string concatenation

With that I am now able to get a correct answer from DKB. Unfortunately my accounts are not accessible as before switching to latest version. I need to analyze this...

Currently I have not yet github correctly setup to simply push the bugfixes, but I think these are extreme simple for you to incorporate @thisistorsten

I'll probably open up a new issue for the other bugs when anlzying them in the next days...

party-pansen avatar Jan 06 '22 21:01 party-pansen

For me DKB is working again, besides the obvious bugfixes I already explained above, I needed to hack HKKAZ. I only did it for the relevant section for my bank and switched it back to some old HKKAZ string. I wonder what these changes in HKKAZ were all about?`It looked very different. Please review this in Branch bugfixes_dkb Regards party-pansen

party-pansen avatar Jan 08 '22 19:01 party-pansen

Can someone please retest?

thisistorsten avatar Jan 13 '22 18:01 thisistorsten

the initial error is gone, but retrieving transactions via HKKAZ is not working for DKB. You did not honor my change to HKKAZ. At least for DKB this must be changed back to the old message...

party-pansen avatar Jan 13 '22 19:01 party-pansen

@party-pansen please recommend your changes here.

torstenprivate avatar Jan 13 '22 19:01 torstenprivate

Please compare with my pushed branch bugfixing_pp. Since the segment now looks very different someone with some insight should have a look at it...

party-pansen avatar Jan 15 '22 19:01 party-pansen

Within the same branch I also added 2 additional fixes for consorsbank, one regarding the consorsbank message format (6241d4e8b3f89f39396599b940b2a3e8608a0ee1) and the other also regarding the HKKAZ (8890b679415c245c2a6d74e84e2e0d278eb65489) Please have a look

party-pansen avatar Jan 15 '22 20:01 party-pansen