Introduce DEFAULT_CONTEXT
git-svn-id: svn+ssh://localhost/home/henryk/svn/cyberflex-shell/trunk@180 f711b948-2313-0410-aaa9-d29f33439f0b
This commit is contained in:
parent
085df9d25c
commit
4ac8a00868
|
@ -39,6 +39,7 @@ class Card:
|
|||
}
|
||||
## For the format of this dictionary of dictionaries see TLV_utils.tags
|
||||
TLV_OBJECTS = {}
|
||||
DEFAULT_CONTEXT = None
|
||||
|
||||
## Format: "AID (binary)": ("name", [optional: description, {more information}])
|
||||
APPLICATIONS = {
|
||||
|
@ -159,7 +160,7 @@ class Card:
|
|||
end = (lastlen + (int(end,0) % lastlen) ) % lastlen
|
||||
else:
|
||||
end = lastlen
|
||||
print TLV_utils.decode(self.last_result.data[start:end], tags=self.TLV_OBJECTS)
|
||||
print TLV_utils.decode(self.last_result.data[start:end], tags=self.TLV_OBJECTS, context = self.DEFAULT_CONTEXT)
|
||||
|
||||
_SHOW_APPLICATIONS_FORMAT_STRING = "%(aid)-50s %(name)-20s %(description)-30s"
|
||||
def cmd_show_applications(self):
|
||||
|
|
|
@ -6,6 +6,7 @@ from generic_card import Card
|
|||
import crypto_utils, tcos_card, TLV_utils
|
||||
from TLV_utils import identifier
|
||||
|
||||
identifier("context_mrtd")
|
||||
identifier("context_EFcom")
|
||||
for _i in range(1,17):
|
||||
identifier("context_EFdg%i" % _i)
|
||||
|
@ -78,6 +79,7 @@ class Passport_Application(Application):
|
|||
DRIVER_NAME = "Passport"
|
||||
APDU_GET_RANDOM = C_APDU(CLA=0, INS=0x84, Le=0x08)
|
||||
APDU_MUTUAL_AUTHENTICATE = C_APDU(CLA=0, INS=0x82, Le=0x28)
|
||||
DEFAULT_CONTEXT = context_mrtd
|
||||
|
||||
AID_LIST = [
|
||||
"a0000002471001"
|
||||
|
@ -254,14 +256,14 @@ class Passport_Application(Application):
|
|||
}
|
||||
|
||||
TLV_OBJECTS = {
|
||||
None: {
|
||||
context_mrtd: {
|
||||
0x60: (TLV_utils.recurse, "EF.COM - Common data elements", context_EFcom),
|
||||
0x77: (TLV_utils.recurse, "EF.SOD - Security Data", context_EFsod),
|
||||
}
|
||||
}
|
||||
|
||||
for _key, (_a, _b) in DATA_GROUPS.items():
|
||||
TLV_OBJECTS[None][_key] = (TLV_utils.recurse, "EF.DG%i - %s" % (_a, _b), globals()["context_EFdg%i" % _a])
|
||||
TLV_OBJECTS[context_mrtd][_key] = (TLV_utils.recurse, "EF.DG%i - %s" % (_a, _b), globals()["context_EFdg%i" % _a])
|
||||
del _key, _a, _b
|
||||
|
||||
def decode_version_number(value):
|
||||
|
|
Loading…
Reference in New Issue