tachograph-reader icon indicating copy to clipboard operation
tachograph-reader copied to clipboard

Gen 2.0 support

Open OscarKro opened this issue 3 years ago • 11 comments

For some reason I can't see the Gen 2.0 support issue so I'll post a new one I quess?

I've been asked to look into rebuilding this library to support Gen 2.0 by someone. So i'm looking into it now to get a rough idea of the amount of work. How far along is it right now? I've tried it on a file and got "First unrecognised region with magic 0 at 0x0000 There were 5219 unmatched regions (magics) in the file." So my quess is it doesn't work yet.

I've worked on a pretty big project where I created software to read digital and smart tachographs out over the net. So I'm a little bit informed in the world of tachographs and the annexes. Can't say I know everything or understand, but I know some stuff. Perhaps I can be of help.

OscarKro avatar Aug 20 '21 10:08 OscarKro

Oscar, I had a client who needed v.2 support. My estimate was 1 - 2 months of work to do it properly. They could not justify the cost, so it was put on hold. The spec looks mind-boggling with its collection of amendments the last time I looked at it. Just wrapping one's head around it all would take time.

The region mapping is not the biggest problem - it's knowing what to map (back to the spec). There is also the signing that needs to be taken care of.

There are proprietary implementations of v.2, so there is hope.

My client may be interested in co-funding the development.

rimutaka avatar Aug 20 '21 12:08 rimutaka

Hey @rimutaka,

Thanks for the reply. I'm getting the same feeling about the amount of time needed to do this as well. Same story, A client requested this. I'll keep you updated if anything comes up or the client is willing to co-fund or whatever construction we can think of.

OscarKro avatar Aug 20 '21 12:08 OscarKro

My 2 cents on the issue. And a bit of rambling. I have created a proprietary library that can import and export DDD structures (and manipulate, import and export them as XML as well). The EU and the device makers have gone to great lengths to make implementation as hard as possible. Not only is the format a mish-mash of hand-crafted binary structures, where in some places space is abundant, and in some places arbitrary length restrictions apply and binary packing tricks are employed, but also ASN.1 and TLV structures. It gets even worse when you shift from the driver cards to the VU transfer protocol (which I also support). In addition, they managed to sprinkle the relevant information over 600 pages of PDF, with the important syntax information put in as JPEGs, despite the fact that PDFs are capable of type setting any complex text layout, and instead of providing one consolidated syntax file. I can barely afford the development as a commercial project, and I have little hopes of any open-source project being able to catch up soon.

And then there is shit like this, just for fun: EU-Mist

graealex avatar Mar 13 '23 22:03 graealex

Yeah it's complete bullshit. I'm now trying to implement the second generation structure as well. I cant even find documentation describing how the second generation is different from the first. This is such a complete rabbit hole... I feel you. Kudo's for getting this far, i'm not even close.

OscarKro avatar Mar 29 '23 08:03 OscarKro

@OscarKro, @rimutaka it is a terrible spec! Really awful. I spent many hours looking at hex dumps...

jugglingcats avatar Mar 29 '23 08:03 jugglingcats

Yes, the spec is bad. Here it is, with the images in the PDF ran through OCR. CELEX_02016R0799-20230821_EN_TXT_AG.pdf

graealex avatar Mar 29 '23 08:03 graealex

Super man! thanks. See if I can make heads or tails of it.

OscarKro avatar Mar 29 '23 09:03 OscarKro

Aside from the jpegs as tables its workable. Annoying to find that few important tables in 600 pages... anyone figured out how to load the cert into openssl maybe? feels kinda hacky to just set the public key. I would've assumed its a well known cert format

tyekx avatar Apr 01 '23 08:04 tyekx

It is a well-known cert format, so called "Card Verifiable Certificate". Unfortunately you need to buy the ISO/IEC 7816-8 for a full specification on the format.

graealex avatar Apr 01 '23 08:04 graealex

This gist might help you with parsing of the TLV data contained in a CV certificate. It's basically the ISO/IEC 7816-6 spec ("Interindustry data elements for interchange") put into a well-documented enum. The TLV Utilities can also be quite helpful.

graealex avatar Apr 01 '23 18:04 graealex

I can easily update this library to support parsing Gen2 and Gen2v2 files. Contact me if you would like to share the development costs: [email protected]

Gen1Pokiman avatar May 26 '24 07:05 Gen1Pokiman