Factor out P2 parameter of SELECT

Add TCOS 3.0 ATR


git-svn-id: svn+ssh://localhost/home/henryk/svn/cyberflex-shell/trunk@157 f711b948-2313-0410-aaa9-d29f33439f0b
This commit is contained in:
hploetz 2007-01-12 11:28:16 +00:00
parent ec3cb54a7f
commit c19a06d7f1
2 changed files with 7 additions and 3 deletions

View File

@ -8,6 +8,8 @@ class ISO_7816_4_Card(Card):
DRIVER_NAME = "ISO 7816-4" DRIVER_NAME = "ISO 7816-4"
FID_MF = "\x3f\x00" FID_MF = "\x3f\x00"
SELECT_P2 = 0x0
## def can_handle(cls, card): ## def can_handle(cls, card):
## return True ## return True
## can_handle = classmethod(can_handle) ## can_handle = classmethod(can_handle)
@ -22,9 +24,9 @@ class ISO_7816_4_Card(Card):
def change_dir(self, fid = None): def change_dir(self, fid = None):
"Change to a child DF. Alternatively, change to MF if fid is None." "Change to a child DF. Alternatively, change to MF if fid is None."
if fid is None: if fid is None:
return self.select_file(0x00, 0x00, "") return self.select_file(0x00, self.SELECT_P2, "")
else: else:
return self.select_file(0x01, 0x00, fid) return self.select_file(0x01, self.SELECT_P2, fid)
def cmd_cd(self, dir = None): def cmd_cd(self, dir = None):
"Change into a DF, or into the MF if no dir is given" "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): def open_file(self, fid):
"Open an EF under the current DF" "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): def cmd_open(self, file):
"Open a file" "Open a file"

View File

@ -436,9 +436,11 @@ class TCOS_Security_Environment(object):
class TCOS_Card(ISO_7816_4_Card,building_blocks.Card_with_80_aa): class TCOS_Card(ISO_7816_4_Card,building_blocks.Card_with_80_aa):
DRIVER_NAME = "TCOS" DRIVER_NAME = "TCOS"
APDU_DELETE_FILE = C_APDU(cla=0x80,ins=0xe4) APDU_DELETE_FILE = C_APDU(cla=0x80,ins=0xe4)
SELECT_P2 = 0x04
ATRS = [ ATRS = [
("3bba96008131865d0064........31809000..", None), ("3bba96008131865d0064........31809000..", None),
("3bbf96008131fe5d0064........31c073f701d00090007d", None), # TCOS 3.0, FIXME: Create new class?
] ]
file_status_descriptions = ( file_status_descriptions = (