I’m currently developing an Android application that needs to read and decode the PDF417 barcode on South African driver’s licences. I’m hoping someone who has worked with this format before can point me in the right direction.
The application is running on a SUNMI Android device with an embedded hardware scanner, and I am successfully receiving the raw barcode payload from the scanner. The PDF417 data is being captured correctly as a byte array.
From what I understand, the data structure of the SA driver’s licence barcode is roughly:
PDF417 barcode
→ binary payload
→ RSA encrypted data block
→ structured licence fields
I have already tried several approaches including:
My goal is to extract the standard fields contained in the licence barcode, such as:
Thanks in advance for any help.
Below is an example of the raw HEX payload extracted from the PDF417 barcode returned by the scanner. This is before any RSA decryption or parsing.
Example HEX payload captured from the PDF417 barcode:
019B0945000060E9A27A1E475F89AF17CB3A5AE86BD91152D22FBCA1F462BA8BD39E9341BB26AD82E3AB1B4E68069247B75286EDB648A7F7A9C37B5E2F2F92D9F1F81F45B1F6FBBE6E8D1D9F9E3E3C98F8B0D4A65CDA3E71A3A9CDE7EAD2C7B9C4B3F1A0A9A92F62CFA2D8E13E3C9A7E65A9B1A4B3C8D1F92E7A1B5C3D8F1A0B7C2E6D1A9C5F3E2D7B4C1A9F8D6B3A1C2E7D4F1B0C9A8E3D7B6F5C4A1D2E3F7B8C9A1D3E5F6B7A8C2D4E1F3A9B6C8D7E5F1A3C9D8B7E6F2A4C1D3E7F8B9A2C4D6E1F3B5C7A9D2E4F6B8C1A3D5E7F9B2C4D6E8F1A3C5D7E9B2C4D6E8F1A3C5D7E9
The application is running on a SUNMI Android device with an embedded hardware scanner, and I am successfully receiving the raw barcode payload from the scanner. The PDF417 data is being captured correctly as a byte array.
From what I understand, the data structure of the SA driver’s licence barcode is roughly:
PDF417 barcode
→ binary payload
→ RSA encrypted data block
→ structured licence fields
I have already tried several approaches including:
- Using ZXing to capture and decode the PDF417 barcode
- Converting the scanned payload to byte arrays and hex strings
- Attempting RSA decryption with BouncyCastle
- Reviewing several open-source implementations of the SA licence decoder (including older B4X and Java examples)
My goal is to extract the standard fields contained in the licence barcode, such as:
- ID number
- Licence number
- Name / surname
- Date of birth
- Issue / expiry dates
- Licence codes and restrictions
- Is the SA driver’s licence barcode still using the same RSA-based encryption scheme used in older open-source decoders, or has the structure changed in newer cards?
- Are there multiple RSA keys or licence versions that need to be handled?
- Does anyone have documentation or examples describing the exact decrypted payload layout (byte offsets / field structure)?
Thanks in advance for any help.
Below is an example of the raw HEX payload extracted from the PDF417 barcode returned by the scanner. This is before any RSA decryption or parsing.
Example HEX payload captured from the PDF417 barcode:
019B0945000060E9A27A1E475F89AF17CB3A5AE86BD91152D22FBCA1F462BA8BD39E9341BB26AD82E3AB1B4E68069247B75286EDB648A7F7A9C37B5E2F2F92D9F1F81F45B1F6FBBE6E8D1D9F9E3E3C98F8B0D4A65CDA3E71A3A9CDE7EAD2C7B9C4B3F1A0A9A92F62CFA2D8E13E3C9A7E65A9B1A4B3C8D1F92E7A1B5C3D8F1A0B7C2E6D1A9C5F3E2D7B4C1A9F8D6B3A1C2E7D4F1B0C9A8E3D7B6F5C4A1D2E3F7B8C9A1D3E5F6B7A8C2D4E1F3A9B6C8D7E5F1A3C9D8B7E6F2A4C1D3E7F8B9A2C4D6E1F3B5C7A9D2E4F6B8C1A3D5E7F9B2C4D6E8F1A3C5D7E9B2C4D6E8F1A3C5D7E9