Referring to:
|
val signatureCreationDate: ByteArray = rawData.readByteArray(4) |
Summary
The Signature Creation Date field in the IDB Header is 3 bytes, as explicitly defined in Table 2. While Section 2.1 defines general Date encoding as 4 bytes (including a date mask), the Header specification intentionally omits the mask byte.
Rationale
ICAO Spec:
https://www.icao.int/sites/default/files/TRIP/Publications/ICAO-TR-ICAO-Datastructure-for-Barcode.pdf
1. Table 2 explicitly specifies 3 bytes
Table 2 (page 10) is the authoritative definition for the IDB Header structure:
| Start |
Length |
Content |
| 0x08 |
3 |
Signature Creation Date |
| Total header length: 11 bytes |
|
|
2. The date mask is unnecessary for Signature Creation Date
Section 2.1 defines the date mask to handle partially unknown dates (e.g., a date of birth where the month is unknown). The mask indicates which parts are known vs unknown.
However, for Signature Creation Date:
• The signature creation date is always fully known – you cannot sign something on an unknown date
• A fully known date has mask 0x00 (Section 2.1: "A fully known date SHALL have a date mask of 0x00")
• Including a byte that is always 0x00 wastes space in a size-constrained barcode
3. Header is optimized for minimal size
The IDB format is designed for barcodes where every byte matters. Omitting a constant 0x00 mask byte is a sensible optimization for a field that can never have unknown components.
4. Section 3.2.4 reference to 2.1 describes the encoding method, not length
Section 3.2.4 says "Refer to section 2.1 for the encoding of this field" – this refers to how the date value is calculated (MMDDYYYY → integer → 3 bytes), not that the mask byte must be included.
Conclusion
The Header uses a compact 3-byte date representation (value only, no mask) because the Signature Creation Date is inherently fully known.
Unfortunately, in the wilderness there are both IDBs that also take 4 bytes for Signature Creation Date (Iceland), but also countries that do it right and take 3 bytes (Cameroon).
So here the ICAO Special was too indistinctible.
Referring to:
vdstools/src/commonMain/kotlin/de/tsenger/vdstools/idb/IdbHeader.kt
Line 80 in 1b449ab
Summary
The Signature Creation Date field in the IDB Header is 3 bytes, as explicitly defined in Table 2. While Section 2.1 defines general Date encoding as 4 bytes (including a date mask), the Header specification intentionally omits the mask byte.
Rationale
ICAO Spec:
https://www.icao.int/sites/default/files/TRIP/Publications/ICAO-TR-ICAO-Datastructure-for-Barcode.pdf
1. Table 2 explicitly specifies 3 bytes
Table 2 (page 10) is the authoritative definition for the IDB Header structure:
2. The date mask is unnecessary for Signature Creation Date
Section 2.1 defines the date mask to handle partially unknown dates (e.g., a date of birth where the month is unknown). The mask indicates which parts are known vs unknown.
However, for Signature Creation Date:
• The signature creation date is always fully known – you cannot sign something on an unknown date
• A fully known date has mask 0x00 (Section 2.1: "A fully known date SHALL have a date mask of 0x00")
• Including a byte that is always 0x00 wastes space in a size-constrained barcode
3. Header is optimized for minimal size
The IDB format is designed for barcodes where every byte matters. Omitting a constant 0x00 mask byte is a sensible optimization for a field that can never have unknown components.
4. Section 3.2.4 reference to 2.1 describes the encoding method, not length
Section 3.2.4 says "Refer to section 2.1 for the encoding of this field" – this refers to how the date value is calculated (MMDDYYYY → integer → 3 bytes), not that the mask byte must be included.
Conclusion
The Header uses a compact 3-byte date representation (value only, no mask) because the Signature Creation Date is inherently fully known.
Unfortunately, in the wilderness there are both IDBs that also take 4 bytes for Signature Creation Date (Iceland), but also countries that do it right and take 3 bytes (Cameroon).
So here the ICAO Special was too indistinctible.