From 85484a977d46c9fa27c05b7a81ee02c5c1dffa35 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Thu, 21 Jan 2021 16:08:56 +0100 Subject: [PATCH] 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 --- pySim/commands.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pySim/commands.py b/pySim/commands.py index d6159ea6..2fb10411 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)