Skip to content

Fix HNSHK security profile version for two-step PIN/TAN#214

Open
markusrauschergmxnet wants to merge 1 commit intoraphaelm:masterfrom
markusrauschergmxnet:fix/hnshk-pin2-twostep-auth
Open

Fix HNSHK security profile version for two-step PIN/TAN#214
markusrauschergmxnet wants to merge 1 commit intoraphaelm:masterfrom
markusrauschergmxnet:fix/hnshk-pin2-twostep-auth

Conversation

@markusrauschergmxnet
Copy link
Copy Markdown

Summary

  • HNSHK signature header always used SecurityProfile(PIN, 1) (one-step) even when two-step TAN authentication (e.g. sf=904) was active. The HNVSK encryption header correctly used PIN:2, but HNSHK still said PIN:1.
  • Banks that strictly validate the security profile version — notably HypoVereinsbank (UniCredit) — rejected the HKTAN segment with error 9210 ("Auftrag abgelehnt. Kein eingereichter Auftrag gefunden") because the signature claimed one-step while a two-step HKTAN segment was present.
  • Additionally, _bootstrap_mode was never reset after fetch_tan_mechanisms(), causing 9075 SCA errors to be silently swallowed instead of properly raised.

Changes

  1. fints/security.py: PinTanAuthenticationMechanism now uses a security_method_version attribute (default 1) for the HNSHK security profile. PinTanTwoStepAuthenticationMechanism overrides it to 2, matching the HNVSK behavior.
  2. fints/client.py: _bootstrap_mode is reset to False after fetch_tan_mechanisms() completes, so that subsequent dialog errors (especially 9075) are properly raised.

Test plan

  • Tested with HypoVereinsbank (BLZ 70020270, appTAN sf=904): Dialog init now receives HITAN with challenge instead of 9210
  • Verified DKB, VR Bank, and Sparkasse still work (these banks don't strictly check the profile version)
  • Successfully retrieved 124 transactions + 3 SEPA accounts from HVB after fix

Fixes #213

The HNSHK signature header always used SecurityProfile(PIN, 1) (one-step)
even when two-step TAN authentication was active. This caused an
inconsistency: HNVSK (encryption) correctly used PIN:2 for two-step,
but HNSHK (signature) still said PIN:1.

Banks that strictly validate the security profile version (notably
HypoVereinsbank/UniCredit) rejected the HKTAN segment with error 9210
("Auftrag abgelehnt") because the signature header claimed one-step
authentication while a two-step TAN segment was present in the message.

This also fixes _bootstrap_mode never being reset after
fetch_tan_mechanisms(), which caused 9075 SCA errors to be silently
swallowed instead of properly raised.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HVB / UniCredit with appTAN: four bugs + structural SCA gap (picks up from #135)

1 participant