]> git.ipfire.org Git - thirdparty/python-fints.git/commitdiff
TAN support in HNSHA
authorRaphael Michel <mail@raphaelmichel.de>
Wed, 25 Jul 2018 14:33:11 +0000 (16:33 +0200)
committerRaphael Michel <mail@raphaelmichel.de>
Thu, 26 Jul 2018 20:27:05 +0000 (22:27 +0200)
fints/client.py
fints/message.py
fints/segments/message.py

index c00a8bb55826098acda99deabdf9738d5e733479..f87255e7273b5b21b44e0ee290b4fc4662051443 100644 (file)
@@ -376,6 +376,6 @@ class FinTS3PinTanClient(FinTS3Client):
         dialog = FinTSDialog(self.blz, self.username, self.pin, self.systemid, self.connection)
         return dialog
 
-    def _new_message(self, dialog: FinTSDialog, segments):
-        return FinTSMessage(self.blz, self.username, self.pin, dialog.systemid, dialog.dialogid, dialog.msgno,
-                            segments, dialog.tan_mechs)
+    def _new_message(self, dialog: FinTSDialog, segments, tan=None):
+        return FinTSMessage(self.blz, self.username, pin, dialog.systemid, dialog.dialogid, dialog.msgno,
+                            segments, dialog.tan_mechs, tan)
index f75038a974258ae2ba06dc0b6917a774a3c29472..4c7f87cba67c517d04acc93225c94442a8c34fcd 100644 (file)
@@ -7,10 +7,11 @@ from .segments.message import HNHBK, HNHBS, HNSHA, HNSHK, HNVSD, HNVSK
 
 
 class FinTSMessage:
-    def __init__(self, blz, username, pin, systemid, dialogid, msgno, encrypted_segments, tan_mechs=None):
+    def __init__(self, blz, username, pin, systemid, dialogid, msgno, encrypted_segments, tan_mechs=None, tan=None):
         self.blz = blz
         self.username = username
         self.pin = pin
+        self.tan = tan
         self.systemid = systemid
         self.dialogid = dialogid
         self.msgno = msgno
@@ -37,7 +38,7 @@ class FinTSMessage:
 
         cur_count = len(encrypted_segments) + 3
 
-        sig_end = HNSHA(cur_count, self.secref, self.pin)
+        sig_end = HNSHA(cur_count, self.secref, self.pin, self.tan)
         self.append_enc_segment(sig_end)
         self.segments.append(HNHBS(cur_count + 1, msgno))
 
index 0f79f32fc9d7bfa5f4762d54790b12c73c27a59f..de199f78198d12639d6cad796f90066b79a87dff 100644 (file)
@@ -117,11 +117,14 @@ class HNSHA(FinTS3Segment):
     SECURITY_SUPPLIER_ROLE = 1  # ISS
     PINTAN_VERSION = 1  # 1-step
 
-    def __init__(self, segno, secref, pin):
+    def __init__(self, segno, secref, pin, tan=None):
+        pintan = fints_escape(pin)
+        if tan:
+            pintan += ':' + fints_escape(tan)
         data = [
             secref,
             '',
-            fints_escape(pin)
+            pintan,
         ]
         super().__init__(segno, data)