diff --git a/fints/client.py b/fints/client.py index 213972a..61ab21c 100644 --- a/fints/client.py +++ b/fints/client.py @@ -1305,6 +1305,9 @@ def fetch_tan_mechanisms(self): else: self.set_tan_mechanism('999') self._ensure_system_id() + # Bootstrap phase (anonymous dialog with sf=999) is complete. + # Reset so that errors in subsequent authenticated dialogs are properly raised. + self._bootstrap_mode = False if self.get_current_tan_mechanism(): # We already got a reply through _ensure_system_id return self.get_current_tan_mechanism() diff --git a/fints/security.py b/fints/security.py index e9f14e1..bab41ac 100644 --- a/fints/security.py +++ b/fints/security.py @@ -99,13 +99,14 @@ def __init__(self, pin): self.pin = pin self.pending_signature = None self.security_function = None + self.security_method_version = 1 def sign_prepare(self, message: FinTSMessage): _now = datetime.datetime.now() rand = random.SystemRandom() self.pending_signature = HNSHK4( - security_profile=SecurityProfile(SecurityMethod.PIN, 1), + security_profile=SecurityProfile(SecurityMethod.PIN, self.security_method_version), security_function=self.security_function, security_reference=rand.randint(1000000, 9999999), security_application_area=SecurityApplicationArea.SHM, @@ -178,6 +179,7 @@ def __init__(self, client, security_function, *args, **kwargs): super().__init__(*args, **kwargs) self.client = client self.security_function = security_function + self.security_method_version = 2 def _get_tan(self): retval = self.client._pending_tan