decode_mrz

override check_sw


git-svn-id: svn+ssh://localhost/home/henryk/svn/cyberflex-shell/trunk@183 f711b948-2313-0410-aaa9-d29f33439f0b
This commit is contained in:
hploetz 2007-02-15 21:16:33 +00:00
parent 09467b61a1
commit e9a4d97dc8
1 changed files with 14 additions and 0 deletions

View File

@ -230,6 +230,12 @@ class Passport_Application(Application):
def get_prompt(self):
return "(%s)%s" % (self.DRIVER_NAME, self.se and "[SM]" or "")
def check_sw(self, sw, purpose = None):
if purpose is not Card.PURPOSE_SM_OK:
return Card.check_sw(self, sw, purpose)
else:
return sw not in ("\x69\x87", "\x69\x88")
def _read_ef(self, fid):
result = self.open_file(fid, 0x0c)
@ -307,6 +313,14 @@ class Passport_Application(Application):
0x5C: (decode_tag_list, "List of all data groups present")
}
def decode_mrz(value):
l = len(value)/2
return "\n" + value[:l] + "\n" + value[l:]
TLV_OBJECTS[context_EFdg1] = {
0x5F1F: (decode_mrz, "Machine Readable Zone data"),
}
if __name__ == "__main__":
mrz1 = "P<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<"