diff options
author | hploetz <hploetz@f711b948-2313-0410-aaa9-d29f33439f0b> | 2007-06-07 21:15:33 +0000 |
---|---|---|
committer | hploetz <hploetz@f711b948-2313-0410-aaa9-d29f33439f0b> | 2007-06-07 21:15:33 +0000 |
commit | bda175ccb2a8bae21a1feb6f26707bdb5c065170 (patch) | |
tree | 8fafcaf61f55833478aedd43390ea58a587e998f /cards | |
parent | 19b862ae2488dd1277d26259c90008b07b79f35a (diff) |
fix mrz2 checksum calculation
git-svn-id: svn+ssh://localhost/home/henryk/svn/cyberflex-shell/trunk@218 f711b948-2313-0410-aaa9-d29f33439f0b
Diffstat (limited to 'cards')
-rw-r--r-- | cards/passport_application.py | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/cards/passport_application.py b/cards/passport_application.py index ec9ceda..ae7fe45 100644 --- a/cards/passport_application.py +++ b/cards/passport_application.py @@ -820,7 +820,7 @@ class Passport(object): else: expanded_document_no = False self.calculate_check_digit(mrz2[:9], mrz2[9], "Document number") - self.nationality = mrz2[10:13] + self.nationality = mrz2[10:13].strip("<") self.date_of_birth = mrz2[13:19] self.calculate_check_digit(mrz2[13:19], mrz2[19], "Date of birth") @@ -845,7 +845,7 @@ class Passport(object): if mrz2[-2] != "<": self.calculate_check_digit(splitted_opt_field[1], mrz2[-2], "Optional data") - self.calculate_check_digit(mrz2[:-1], mrz2[-1], "Second line of machine readable zone") + self.calculate_check_digit(mrz2[0:10]+mrz2[13:20]+mrz2[21:43], mrz2[-1], "Second line of machine readable zone") print self.type, self.issuer, self.name print self.document_no, self.nationality, self.date_of_birth, self.sex, self.expiration_date, self.optional @@ -877,6 +877,3 @@ if __name__ == "__main__": ## biometric.store(basename= "biometric_testdg2_%02i" % index) p = Passport([mrz1, mrz2]) - - - |