@@ -272,16 +272,19 @@ def finalizeInput(self, outputAddress, amount, fees, changePath, rawTx=None):
272272 if result ['confirmationType' ] == 0x02 :
273273 result ['keycardData' ] = response [1 + response [0 ] + 1 :]
274274 if result ['confirmationType' ] == 0x03 :
275- offset = 1 + response [0 ]
276- result [ 'keycardData' ] = response [offset + 1 : offset + 1 + response [ offset ] ]
275+ offset = 1 + response [0 ] + 1
276+ keycardDataLength = response [offset ]
277277 offset = offset + 1
278+ result ['keycardData' ] = response [offset : offset + keycardDataLength ]
279+ offset = offset + keycardDataLength
278280 result ['secureScreenData' ] = response [offset :]
279281 result ['outputData' ] = response [1 : 1 + response [0 ]]
280282 return result
281283
282284 def finalizeInputFull (self , outputData ):
283285 result = {}
284286 offset = 0
287+ encryptedOutputData = ""
285288 while (offset < len (outputData )):
286289 blockLength = 255
287290 if ((offset + blockLength ) < len (outputData )):
@@ -294,13 +297,22 @@ def finalizeInputFull(self, outputData):
294297 p1 , 0x00 , dataLength ]
295298 apdu .extend (outputData [offset : offset + dataLength ])
296299 response = self .dongle .exchange (bytearray (apdu ))
300+ encryptedOutputData = encryptedOutputData + response [1 : 1 + response [0 ]]
297301 offset += dataLength
298- result ['confirmationNeeded' ] = response [0 ] <> 0x00
299- result ['confirmationType' ] = response [0 ]
300- if result ['confirmationType' ] == 0x02 :
301- result ['keycardData' ] = response [1 :]
302- if result ['confirmationType' ] == 0x03 :
303- result ['secureScreenData' ] = response [1 :]
302+ result ['confirmationNeeded' ] = response [1 + response [0 ]] <> 0x00
303+ result ['confirmationType' ] = response [1 + response [0 ]]
304+ if result ['confirmationType' ] == 0x02 :
305+ offset = 1 + response [0 ] + 1
306+ keycardDataLength = response [offset ]
307+ result ['keycardData' ] = response [offset : offset + keycardDataLength ]
308+ if result ['confirmationType' ] == 0x03 :
309+ offset = 1 + response [0 ] + 1
310+ keycardDataLength = response [offset ]
311+ offset = offset + 1
312+ result ['keycardData' ] = response [offset : offset + keycardDataLength ]
313+ offset = offset + keycardDataLength
314+ result ['secureScreenData' ] = response [offset :]
315+ result ['encryptedOutputData' ] = encryptedOutputData
304316 return result
305317
306318 def untrustedHashSign (self , path , pin = "" , lockTime = 0 , sighashType = 0x01 ):
0 commit comments