From: Raphael Michel Date: Wed, 25 Jul 2018 14:33:11 +0000 (+0200) Subject: TAN support in HNSHA X-Git-Tag: v1.0.0~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0cd1c84090d1a06a946a29658a089e6007de7b45;p=thirdparty%2Fpython-fints.git TAN support in HNSHA --- diff --git a/fints/client.py b/fints/client.py index c00a8bb..f87255e 100644 --- a/fints/client.py +++ b/fints/client.py @@ -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) diff --git a/fints/message.py b/fints/message.py index f75038a..4c7f87c 100644 --- a/fints/message.py +++ b/fints/message.py @@ -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)) diff --git a/fints/segments/message.py b/fints/segments/message.py index 0f79f32..de199f7 100644 --- a/fints/segments/message.py +++ b/fints/segments/message.py @@ -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)