Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Decode South African (ZA) Drivers License

Tags:

barcode

I am writing a solution to scan PDF417 barcode (http://en.wikipedia.org/wiki/PDF417) at the back of a South African drivers license for iOS. I can't find any documentation or specification how to decode barcode. Does anyone have a link to a specification or sample code that can decode driver license data stored in PDF417 barcode? Thanks

like image 850
Lennie Avatar asked Jul 09 '13 13:07

Lennie


1 Answers

The data after scanning the PDF417 barcode is 720 bytes. First 4 bytes indicate the version of barcode. Version 2 covers all currently valid licenses.

Version 1: 01 e1 02 45

Version 2: 01 9b 09 45

Next two bytes are zero (00 00).

Remaining 714 bytes form 6 blocks - 5 blocks of 128, 1 block of 74.

Different keys are used depending on version and and block size.

Version 1, 128 bytes

-----BEGIN RSA PUBLIC KEY-----
MIGXAoGBAP7S4cJ+M2MxbncxenpSxUmBOVGGvkl0dgxyUY1j4FRKSNCIszLFsMNw
x2XWXZg8H53gpCsxDMwHrncL0rYdak3M6sdXaJvcv2CEePrzEvYIfMSWw3Ys9cRl
HK7No0mfrn7bfrQOPhjrMEFw6R7VsVaqzm9DLW7KbMNYUd6MZ49nAhEAu3l//ex/
nkLJ1vebE3BZ2w==
-----END RSA PUBLIC KEY-----

Version 1, 74 bytes:

-----BEGIN RSA PUBLIC KEY-----
MGACSwD/POxrX0Djw2YUUbn8+u866wbcIynA5vTczJJ5cmcWzhW74F7tLFcRvPj1
tsj3J221xDv6owQNwBqxS5xNFvccDOXqlT8MdUxrFwIRANsFuoItmswz+rfY9Cf5
zmU=
-----END RSA PUBLIC KEY-----

Version 2, 128 bytes:

-----BEGIN RSA PUBLIC KEY-----
MIGWAoGBAMqfGO9sPz+kxaRh/qVKsZQGul7NdG1gonSS3KPXTjtcHTFfexA4MkGA
mwKeu9XeTRFgMMxX99WmyaFvNzuxSlCFI/foCkx0TZCFZjpKFHLXryxWrkG1Bl9+
+gKTvTJ4rWk1RvnxYhm3n/Rxo2NoJM/822Oo7YBZ5rmk8NuJU4HLAhAYcJLaZFTO
sYU+aRX4RmoF
-----END RSA PUBLIC KEY-----

Version 2, 74 bytes:

-----BEGIN RSA PUBLIC KEY-----
MF8CSwC0BKDfEdHKz/GhoEjU1XP5U6YsWD10klknVhpteh4rFAQlJq9wtVBUc5Dq
bsdI0w/bga20kODDahmGtASy9fae9dobZj5ZUJEw5wIQMJz+2XGf4qXiDJu0R2U4
Kw==
-----END RSA PUBLIC KEY-----

Decrypt each block separately. Decrypted with RSA ENCRYPT function using the public key.

like image 119
2 revs Avatar answered Sep 29 '22 06:09

2 revs