Fix size determination in building blocks
Create tcos 3.0 class git-svn-id: svn+ssh://localhost/home/henryk/svn/cyberflex-shell/trunk@163 f711b948-2313-0410-aaa9-d29f33439f0b
This commit is contained in:
parent
0d21b554e5
commit
c34c6a084c
|
@ -38,10 +38,10 @@ class Card_with_ls:
|
|||
response_DF = {}
|
||||
response_EF = {}
|
||||
for DF in dirs:
|
||||
response_DF[DF] = self.select_file(0x01, 0x00, DF)
|
||||
response_DF[DF] = self.select_file(0x01, self.SELECT_P2, DF)
|
||||
self.select_file(0x03, 0x00, "")
|
||||
for EF in files:
|
||||
response_EF[EF] = self.select_file(0x02, 0x00, EF)
|
||||
response_EF[EF] = self.select_file(0x02, self.SELECT_P2, EF)
|
||||
|
||||
self.sw_changed = False
|
||||
|
||||
|
@ -57,7 +57,11 @@ class Card_with_ls:
|
|||
for FID in files:
|
||||
name = " " + utils.hexdump(FID, short=True) + " "
|
||||
type = "EF"
|
||||
size = self._str_to_long(self._find_recursive(self.LS_L_SIZE_TAG, response_EF[FID].data))
|
||||
v = self._find_recursive(self.LS_L_SIZE_TAG, response_EF[FID].data)
|
||||
if v:
|
||||
size = self._str_to_long(v)
|
||||
else:
|
||||
size = "n/a"
|
||||
print self._ls_l_template % locals()
|
||||
else:
|
||||
print "\n".join( ["[%s]" % utils.hexdump(a, short=True) for a in dirs]
|
||||
|
|
|
@ -434,13 +434,12 @@ class TCOS_Security_Environment(object):
|
|||
self.keys[keyref] = keyvalue
|
||||
|
||||
class TCOS_Card(ISO_7816_4_Card,building_blocks.Card_with_80_aa):
|
||||
DRIVER_NAME = "TCOS"
|
||||
DRIVER_NAME = "TCOS 2.0"
|
||||
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 = (
|
||||
|
@ -674,3 +673,12 @@ class TCOS_Card(ISO_7816_4_Card,building_blocks.Card_with_80_aa):
|
|||
"set_key": cmd_set_key,
|
||||
}
|
||||
|
||||
class TCOS_3_Card(TCOS_Card):
|
||||
DRIVER_NAME = "TCOS 3.0"
|
||||
APDU_DELETE_FILE = C_APDU(cla=0x80,ins=0xe4)
|
||||
SELECT_P2 = 0x04
|
||||
LS_L_SIZE_TAG = 0x80
|
||||
|
||||
ATRS = [
|
||||
("3bbf96008131fe5d0064........31c073f701d00090007d", None),
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue