diff options
author | hploetz <hploetz@f711b948-2313-0410-aaa9-d29f33439f0b> | 2007-02-15 21:16:33 +0000 |
---|---|---|
committer | hploetz <hploetz@f711b948-2313-0410-aaa9-d29f33439f0b> | 2007-02-15 21:16:33 +0000 |
commit | e9a4d97dc837dbe578f64f0187f3cd146eb2b86b (patch) | |
tree | 8b92c526df31bf7b51a71827c71ae24bb0a569c1 /cards | |
parent | 09467b61a18242743d86d5491ccb2fd1e69aa1a3 (diff) |
decode_mrz
override check_sw
git-svn-id: svn+ssh://localhost/home/henryk/svn/cyberflex-shell/trunk@183 f711b948-2313-0410-aaa9-d29f33439f0b
Diffstat (limited to 'cards')
-rw-r--r-- | cards/passport_application.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cards/passport_application.py b/cards/passport_application.py index cc87c1b..7b595a4 100644 --- a/cards/passport_application.py +++ b/cards/passport_application.py @@ -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<<<<<<<<<<<<<<<<<<<" |