diff --git a/cards/iso_7816_4_card.py b/cards/iso_7816_4_card.py index 101c98c..23033e2 100644 --- a/cards/iso_7816_4_card.py +++ b/cards/iso_7816_4_card.py @@ -8,6 +8,8 @@ class ISO_7816_4_Card(Card): DRIVER_NAME = "ISO 7816-4" FID_MF = "\x3f\x00" + SELECT_P2 = 0x0 + ## def can_handle(cls, card): ## return True ## can_handle = classmethod(can_handle) @@ -22,9 +24,9 @@ class ISO_7816_4_Card(Card): def change_dir(self, fid = None): "Change to a child DF. Alternatively, change to MF if fid is None." if fid is None: - return self.select_file(0x00, 0x00, "") + return self.select_file(0x00, self.SELECT_P2, "") else: - return self.select_file(0x01, 0x00, fid) + return self.select_file(0x01, self.SELECT_P2, fid) def cmd_cd(self, dir = None): "Change into a DF, or into the MF if no dir is given" @@ -41,7 +43,7 @@ class ISO_7816_4_Card(Card): def open_file(self, fid): "Open an EF under the current DF" - return self.select_file(0x02, 0x00, fid) + return self.select_file(0x02, self.SELECT_P2, fid) def cmd_open(self, file): "Open a file" diff --git a/cards/tcos_card.py b/cards/tcos_card.py index 5dfe321..b5259a4 100644 --- a/cards/tcos_card.py +++ b/cards/tcos_card.py @@ -436,9 +436,11 @@ class TCOS_Security_Environment(object): class TCOS_Card(ISO_7816_4_Card,building_blocks.Card_with_80_aa): DRIVER_NAME = "TCOS" APDU_DELETE_FILE = C_APDU(cla=0x80,ins=0xe4) + SELECT_P2 = 0x04 ATRS = [ ("3bba96008131865d0064........31809000..", None), + ("3bbf96008131fe5d0064........31c073f701d00090007d", None), # TCOS 3.0, FIXME: Create new class? ] file_status_descriptions = (