aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2021-01-21 16:08:56 +0100
committerHarald Welte <laforge@osmocom.org>2021-03-02 14:26:32 +0100
commit85484a977d46c9fa27c05b7a81ee02c5c1dffa35 (patch)
tree6c1b43fe18a87a86479be931078739bc8d43a0bb
parentc0499c83306c7e740a81a6a28d81bb0560c28a21 (diff)
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
-rw-r--r--pySim/commands.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/pySim/commands.py b/pySim/commands.py
index d6159ea..2fb1041 100644
--- a/pySim/commands.py
+++ b/pySim/commands.py
@@ -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)