Mystery: 4 Bytes should represent a Date, but how?

1.3k views Asked by At

So I've been able to read some unsecured values from an official German smartcard. It works fine for Numbers and Strings, but I can't wrap my head around how to interpret Dates.

The date I want to read is specified as 4 Byte Date as seen in the spec: https://i.stack.imgur.com/d4Zzs.jpg

The four bytes I read are:

0x4f 0x41 0x8d 0x00 (hex)
0100 1111 0100 0001 1000 1101 0000 0000 (binary)

and should represent this date: 20.02.2012 binary:

20 - 0001 0100
02 - 0000 0010
2012 - 0111 1101 1100

Another one:

0x58 0xAA 0x31 0x7f (hex)
0101 1000 1010 1010 0011 0001 0111 1111 (binary)

should represent: 19.02.2017

19 - 0001 0011
02 - 0010
2017 - 0111 1110 0001

Please help me to solve this Encoding-Riddle


The data from the card can be read by a commercial software, so I guess the raw data I get is usable in any way.

For the interested: The vendor has a very huge specification which I've searched for numerous times (http://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32002R1360:DE:NOT Available in multiple Languages) The structure of the card is first mentioned on page 119

1

There are 1 answers

2
dtb On BEST ANSWER

The linked specification says that cardIssueDate is of type TimeReal (Section 2.20.). The same specification defines TimeReal as the number of seconds since 1970-01-01 00:00:00 GMT (i.e. UNIX time) encoded as ASN.1 INTEGER (Section 2.110.).