commands.py: Introduce a real select_file() method

This method, like select_adf(), only selects a single file ID
and unlike select_path() returns the actual status words returned by the
card.

Change-Id: I8bc86654c6d79f2428e196cc8a401e12d93a676b
This commit is contained in:
Harald Welte
2021-01-21 16:08:56 +01:00
parent c0499c8330
commit 85484a977d

View File

@@ -115,10 +115,13 @@ class SimCardCommands(object):
if type(dir_list) is not list:
dir_list = [dir_list]
for i in dir_list:
data, sw = self._tp.send_apdu_checksw(self.cla_byte + "a4" + self.sel_ctrl + "02" + i)
data, sw = self.select_file(i)
rv.append(data)
return rv
def select_file(self, fid):
return self._tp.send_apdu_checksw(self.cla_byte + "a4" + self.sel_ctrl + "02" + fid)
def select_adf(self, aid):
aidlen = ("0" + format(len(aid) // 2, 'x'))[-2:]
return self._tp.send_apdu_checksw(self.cla_byte + "a4" + "0404" + aidlen + aid)