While playing around with the PDF417 barcode scanner I thought I would check what info is hiding inside the PDF417 barcode on my driver's license. So, I got the following 720 bytes of hex data from it:
I have added "HEX = " to the string above. Now apparently the above data is arranged as follows:
1. first 4 bytes - if 01 e1 02 45 then version 1 license else version 2 license (the first 4 bytes in my license are 01 9b 09 45 and therefore it corresponds with version 2) - see here https://stackoverflow.com/questions/17549231/decode-south-african-za-drivers-license
2. The next two bytes are 00 and 00
3. The remainder of the 714 bytes are split into 5 blocks of 128 bytes and 1 block of 74 bytes. The first block of 128 bytes are as follows (and I believe it contains most of the text info - there is apparently image data stored in these blocks as well....):
The 5 blocks containing 128 bytes each must be decrypted with RSA decryption making use of the following public key:
The last block of 74 bytes must also be decrypted making use of RSA decryption but with the following public key:
The only other "tip" that I could find is the following:
Decrypt each block separately. Decrypted with RSA ENCRYPT function using the public key.
Where and how do I start with this in B4A to make sense of the hex code data that I have extracted from my license?
B4X:
HEX = 019b09450000
6713c45dcaf37a7573c2daed9badf4374e3629389f8a6bf3c65104384407f66f3233d4bab833052c89dd15cc80f930691ff8fcc77bf0494ea408b5ec0465a9b88580c95c46cc21349fca03a10b95778cbd9672c53d150e4aae7cbf9b61bdadcd3c69f11033236d2e1227f69f49db401a85a7021a547c616b7038337238d37d10
86bb3c730c737faac164bae9cdaf0273904fa875799078779660f87fbf0a28af53739ac87c39758100fd9bcc3bedc8716c35212b7f911add64c43281bd18eb12f1bc7f01249f14ecf7e6e8ed2e2c66f32f0716aef21b5b7febd889457632caaa878b6d253d5d4f038de565df54b29c8b3dd87714780c0e8c027b1577d9375f76
c2ee868bf2760e27dd2ac4b1611ac2f0695884d2eb80b00c2cd52505a3f3acf58a2306a47172519e67dd3c5ac1e6e49f8535fec93e8d9b322ef9ba2cc5b092ede4a45fa0ba7c014463e860d6faf105ebec9baee6a3255c343a0cc9974b379a7d70b346986688513ef22493fb4d1ae8443cd721827f7eec933891e07f471cc2e1
97c11ea82233d32c666f70802dae71d2bafcec2550f7458d40c23f0c0f3d9452253d9ae6c79bd7d9592fa744c1c3c40b945f48693ca1b447675987ea51d631bed99c63865b25a8446ff2259a454f3707646c27812f175410c930c82c60c3126755650c5d137dcd15b286c32dcccbb3074d667299144df44cc4eb24675e882783
5a581ef384754c2c007d720d82c89c7608cac15437b060f2ef9a97547fca3adbad61da1e9b0db9061fe83c10cf326e92b8b7e787ef8e45ffc056e100a504ae09578fdcedd0d3abf1286c776e7a4bfd02b93f34e9121bf66f17a77a4db36ba04032a553892d1c3f6c377be4f7696357bebaa983ea3166592c8afc35282ae55aba
64d83f7436aa0b4b58670855a28f2e14e67b2e84411e39b7fe19cd68be5ca411b9f60a9f0339e19ae8bda50223fb4930df0b8a20ed4528a601296a814721245db392b6afa929f1d547c3
I have added "HEX = " to the string above. Now apparently the above data is arranged as follows:
1. first 4 bytes - if 01 e1 02 45 then version 1 license else version 2 license (the first 4 bytes in my license are 01 9b 09 45 and therefore it corresponds with version 2) - see here https://stackoverflow.com/questions/17549231/decode-south-african-za-drivers-license
2. The next two bytes are 00 and 00
3. The remainder of the 714 bytes are split into 5 blocks of 128 bytes and 1 block of 74 bytes. The first block of 128 bytes are as follows (and I believe it contains most of the text info - there is apparently image data stored in these blocks as well....):
B4X:
6713c45dcaf37a7573c2daed9badf4374e3629389f8a6bf3c65104384407f66f3233d4bab833052c89dd15cc80f930691ff8fcc77bf0494ea408b5ec0465a9b88580c95c46cc21349fca03a10b95778cbd9672c53d150e4aae7cbf9b61bdadcd3c69f11033236d2e1227f69f49db401a85a7021a547c616b7038337238d37d10
The 5 blocks containing 128 bytes each must be decrypted with RSA decryption making use of the following public key:
B4X:
-----BEGIN RSA PUBLIC KEY-----
MIGWAoGBAMqfGO9sPz+kxaRh/qVKsZQGul7NdG1gonSS3KPXTjtcHTFfexA4MkGA
mwKeu9XeTRFgMMxX99WmyaFvNzuxSlCFI/foCkx0TZCFZjpKFHLXryxWrkG1Bl9+
+gKTvTJ4rWk1RvnxYhm3n/Rxo2NoJM/822Oo7YBZ5rmk8NuJU4HLAhAYcJLaZFTO
sYU+aRX4RmoF
-----END RSA PUBLIC KEY-----
The last block of 74 bytes must also be decrypted making use of RSA decryption but with the following public key:
B4X:
-----BEGIN RSA PUBLIC KEY-----
MF8CSwC0BKDfEdHKz/GhoEjU1XP5U6YsWD10klknVhpteh4rFAQlJq9wtVBUc5Dq
bsdI0w/bga20kODDahmGtASy9fae9dobZj5ZUJEw5wIQMJz+2XGf4qXiDJu0R2U4
Kw==
-----END RSA PUBLIC KEY-----
The only other "tip" that I could find is the following:
Decrypt each block separately. Decrypted with RSA ENCRYPT function using the public key.
Where and how do I start with this in B4A to make sense of the hex code data that I have extracted from my license?
Last edited: