readESM – Reading Digital Tachograph files

Update, November 2011: See the post about readesm 2011 and the sourceforge project page for newer descriptions of readesm.

Update, March 2011: There is a new release of readesm, The description provided here no longer applies, the new readesm uses Qt and cmake. You can get the new release at the sourceforge project page and read the documentation here.

For several years now, new trucks sold in the European union are equipped with digital tachographs, that record the driving times and replace the older chart-based mechanical tachographs.

For companies in road transport that means, although in theory they get nice data about their drivers and vehicles, in practice they have to pay a lot of money for the digital tachograph and the associated equipment, which is then used against them – the old fraud schemes no longer work, the machine cruelly gives every police officer the driving times of the last 28 days (and could give much more).

The usability of the devices I’m familiar with is also abysmal. It just takes forever to read out the data (9600 baud per default, 115000 baud maximal, but i guess the company’s software does just the former), and the drivers have to keep track of their times manually – just not up to par with 2009 technology.

The company also had just a very bad software for analyzing the data recorded by the card and the digital tachograph, so I was asked to write a simple visualization program.

Compiling

You can get the program files from this page, or from the development page at Sourceforge.
Since so far there is no binary distribution for the program, you will have to compile it yourself.
To do that, you need a c++ compiler, parts of the boost library (specifically program_options and shared_ptr) and the Gnu MP library, wich is used to check the various RSA signatures. Once all those are installed, typing make/make install should work fine. On Ubuntu systems, you will need to do something like:

svn co https://readesm.svn.sourceforge.net/svnroot/readesm readesm
sudo apt-get install libboost-program-options-dev libgmpxx4ldbl  libgmp3-dev
make
sudo make install

You can of course also use checkinstall instead of make install, or type make package, which invokes checkinstall.

Running the program

In most circumstances, you will run the program from the commandline like this:

readesm --infile foo.esm --outfile bar.html --format=html

Alternatively, if no output file is specified, stdout is used. For KDE users, i wrote a little wrapper script named readesm-wrap-kde.sh. It will get installed my typing make install

Security

It is a really pleasant surprise to see a nice security model in the digital tachographs, considering the rules for the security implementations were made by politicians. Both cards and vehicle units work with 1024-bit RSA keys, and each vehicle unit has its own key, with an certificate signed by the member state, which in turn is signed by an European master key. Data is hashed with SHA-1, subsequently padded and signed by the vehicle unit, and that signature appended to the readouts. The law even states that the companies have to store the data in this signed form, so there is little chance to tamper with the data, once recorded.

Since the most likely attacker – the evil manager who wants to exploit the drivers – has physical access to the card and vehicle unit, which contain the private keys, even 1024-bit RSA provides no absolute security. The manager could try a timing attack, or take a really close look at the storage, both times avoiding having to solve the RSA problem.

The connection from tachograph to sensor is also secured, using Triple-DES. The week point here is the sensor – a successful attack against the sensors some DAF trucks are equipped with is to disturb it using strong permanent magnets, thereby preventing it from recognizing the changing magnetic fields.

All possible attacks against the security system however face the problem of being unveiled by police checkpoints or a cross-correlation of the faked data with data from other sources, for example the toll systems recording every few highway kilometers in Germany.

error, cannot open image photos/screenshots/readesm/2011.11. link to photos/screenshots/readesm/readesm_0.3.2_german_locale.png link to photos/screenshots/readesm/alpha_html_control.png link to photos/screenshots/readesm/alpha_html_output.png link to photos/screenshots/readesm/card_error.png link to photos/screenshots/readesm/readesm_0.3.2_windows_xml_2.PNG


This is the historical release, described in this post, in case you do not like Qt. Otherwise, check the newer versions.

filetype readesm.tar.bz2 (60.86 kiB, 2009-05-19)

This entry was posted in Computers, Vehicles and tagged , , . Bookmark the permalink.

61 Responses to readESM – Reading Digital Tachograph files

  1. Animha says:

    Hello,
    I read your article and found it very interesting.. I’m trying to create a .NET reader for my company (with have a small truck fleet).
    I took a look at your source code but it’s a bit hard for me to understand (I’m not used in programming in c++, i use c#)..

    I’m OK with downloading the data from the card, but I don’t know the structure of the file (cant find it in any official website). Do you have any document you started from with the techincal specification of the file?
    I just need the order and the length of the fields, just to start.. that could help me so much.

    Thank you in advance, if you could help me I’ll really appreciate.
    Animha

  2. Andreas Goelzer says:

    I used http://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=OJ:L:2002:207:0001:0252:EN:PDF as a starting point, there might be a newer version on there servers, though. I also found a corrigendum somewhere online, but I don’t remember where. The most important corrigendum was:

    On page 57, in point 2.5 CardActivityDailyRecord:
    after:
    activitypreviousrecordlength
    insert new line:
    activityrecordlength

    without that information it’s a bit difficult :)

    Keep in mind the data format differs quite a lot between the vehicle units and the cards, the cards have real tag-length-value, while you’ll have to know the structure of all datasets to be able to parse the vu data.

  3. Animha says:

    Thank you, I’ll have a look at it (wow it looks quite huge!!).
    Animha

  4. Andreas Goelzer says:

    It is quite huge, but you do not need to concern yourself with most of it, like electrical connections and that stuff. I guess you are mostly interested in activity data, for that you’ll need to read only a couple of pages(10 or so). Good luck and have fun coding :)

  5. Andreas Goelzer says:

    Just found out it is available in several languages, for example
    http://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=OJ:L:2002:207:0001:0252:ES:PDF
    for the Spanish version, …DE… for the German one.

  6. Accystanley says:

    Hi, thanks for the software, my friend needed to view some .esm files on a windows PC and I managed to use the command line to convert and pull the data into Excel, thanks a lot!
    The only problem is my friend isn’t IT literate and explaining how to do this is a daunting prospect! Have you come across a freeware Windows .esm file viewer/convertor?

    thanks again
    Accy

  7. Andreas Goelzer says:

    Hello, sorry for responding so late. Last I checked, there was no such software. There are some web-based solutions, some quite cheap – but giving away signed data of ones driving times is imho a bad idea. I tried compiling readesm for windows – without crypto support that is possible, even crosscompiling from a linux computer works. However, explaining a command-line-program to the average windows user is a daunting task, and i haven’t had much success with creating packages. If i find the time, i’ll write a qt frontend for readesm, that should also make it easier in linux – but right now I am busy with other things.

  8. Matija says:

    Hi, I have read given PDF and I hope I will shortly have Windows application able to read and analyze driver cards…
    For now, I finished basic EF analysis and am working on detailed driver activities during recorded days.

    I hope I will also make some freeware release and will post here…

  9. Isaac says:

    Hi,
    I try to create de file of drive. I see the document by i have problems with PERFORMS HASH OF FILE instruction. Because all time answear the error code 6D00.

    The instruction that i use is 80h 2Ah 90h 00h,

    I only need create the files but when i need make a hash code with de instruction PERFORMS HAS OF FILE ( Apendix 2, 3.16.12) answear 6D00

    Thank for avance

  10. jj says:

    Hello,

    I work in small truck company. Your article is very very interersting. I’m interesting in develop an appliacion to download file from tachograph. Do you know where can I found the protocol to download informacion from tachograph.

    Thanks and best regards,

  11. Andreas Goelzer says:

    jj: Information about the download protocol as well as about electrical and mechanical connections is in the european law linked in my other comments here.

    Isaac: I’m sorry, haven’t tried downloading yet. It would be nice to have it working though, downloading with the software we have for downloading takes ages and is unstable.

    Matija: Looking forward to see it :)

  12. Rocco Pier Luigi says:

    Current version (with corrigendum) is od CE regulation is
    http://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CONSLEG:2002R1360:20020825:EN:PDF

    You can check for new version starting from here: http://eur-lex.europa.eu/
    choose language (EN)
    choose “SIMPLE SEARCH”
    choose “Search by document number: Natural Number”
    choose “Regulation” and insert year (2002) and number (1360)

    You get a list of original regulation and of corrigendum

  13. Andreas Goelzer says:

    Thanks a lot, I have been wondering about that.

  14. Eddy says:

    Matija,
    Already have any luck with coding a reader in .Net,
    I’m a VB.net programmer myself but also understand C#, if you have a working code to read out a digital tacho drivers card in .Net, would you be able to send me an example code of how to do this in .Net,
    I already have found freeware softwxare to read out the cards but these are with a frontend, where i’m particulary intrested in reading out the mileage (in KM) a driver has made on his day, + the current value in Kilometers of the truck itself, i have noticed that this data is also recorded on the digital driver card.
    Tnx a lot in advance for any answer of your part.

  15. Jose Huguet says:

    I am proving the readesm, but in some files it gives me mistake. ” Exception of floating point “. In other files it works perfectly. I am executing in Debian Lenny 5.0.7. Can you give me some indication to solve the problem?

  16. Jose Huguet says:

    Why the serial number of the sensor is encrypted, and vuSerialNumber?
    “——————————–
    Technical Data
    vuManufacturerMame Siemens AG SV
    vuManufacturerAddress H.-Hertz-Str.45 78052 VS-Villingen
    vuPartNumber 1381.1052300005
    vuSerialNumber v¡
    vuSoftwareVersion 120E
    vuSoftInstallationDate mar 08 may 2007 12:01:40 GMT
    vuManufacturingDate mar 08 may 2007 00:00:00 GMT
    vuApprovalNumber e1-84
    sensorSerialNumber êá
    sensorApprovalNumber e1-175
    sensorPairingDateFirst lun 04 jun 2007 08:47:09 GMT
    “——————————
    Thank you

  17. Richard says:

    Has anyone compiled this on freebsd?

    I’m getting the following error.

    [richard@fox ~/readesm]$ make
    “Makefile”, line 16: Missing dependency operator
    “Makefile”, line 18: Need an operator
    “Makefile”, line 20: Need an operator
    Error expanding embedded variable.

  18. Andreas Goelzer says:

    Richard: I switched from my custom Makefile to cmake, you might want to try compiling from svn. It’s still a bit undocumented though, and might not even compile or run at all times. There will be a new release soon.

    Jose: Decoding serial numbers is not yet implemented, the current svn version prints out the hex values instead of garbage, though.

  19. I have the same problem as Jose Huguet.
    “I am proving the readesm, but in some files it gives me mistake. ” Exception of floating point “. In other files it works perfectly. I am executing in Debian Lenny 5.0.7. Can you give me some indication to solve the problem?”

    I donot see any answer for this question and have the same problem. All my .ddd files cannot be read by readesm. I use Ubuntu.

    Putting ‘readesm’ in console gives me: “Bus::open: Can not get ibus-deamon’s address.
    IBusInputContext::createInputContext: no connection to ibus-daemon”.
    I even install all ‘IBus’ packages dedicated to Ubuntu to solve this problem. But I donot even know it is a problem.

    Please help me. Best regards Pawel Karamuz

  20. Andreas Goelzer says:

    Jose, Pawel: Sorry, I accidentally only answered Jose’s second question. I have no idea where a floating point exception could occur, as readesm does not use any floating point numbers directly. It might be caused by programming errors in readesm, though.

    That IBus error also happens on my Ubuntu, it seems harmless.

    As I only have access to files from a small subset of cards and vehicle unit manufacturers, it is well possible readesm cannot read those from other manufacturers. You can send me files in order to help me make readesm understand them. However, for your own sake, take an older file, at least a month old and/or encrypt it with my gpg key (http://n.ethz.ch/~goelzera/goelzera.asc).

  21. Andreas Goelzer says:

    Ok, found the error. For some reason an integer division by zero could causes a floating point error, live and learn. Try compiling from subversion, that may give you the first few blocks of the file and the hex values of the remaining data.

  22. Jose Huguet says:

    Hello Andreas, several topics:

    1.-You are the best of the world!!! :-)
    2.-There is a small bug in the documentation “sudo apt-get install build-essential” not “essentials”
    3.-When I execute the command
    # readesm file.tgd file.txt
    it gives me the following message
    “readesm: cannot connect to X server”
    I can use “readesm –infile xxxxx –outfile yyyy –format=text|xml|html” ?
    4.- Can you make the version compiled for windows with RSA?

    Thank you for sharing your work with us.
    Jose Huguet

  23. Andreas Goelzer says:

    Jose:
    1. Thanks :)
    2. Thanks, is fixed now.
    3. I committed a quick fix for that in the subversion repository. It should work without X now. The old command line format with –infile and –format no longer works (for now, –format will eventually come back)
    4. I hope so, but the two libraries I use to get a more or less efficient implementation of sha-1 and rsa seem more at home in the linux world. Maybe i’ll be able to compile it once I’m a bit more familiar with mingw and developing in windows.

  24. Jose Huguet says:

    Hi Andreas,
    Thank you for answering so rapidly!.

    I have found 2 small bugs:

    1.-VehicleIdentificationNumber is absent the first character.
    2.-In card number exceeds the first character, since it is in the habit of being ^O or ^Q at least in the files that I have processed.

    How can I you send a few files, with this problems?. My account of e-mail is bsra@itemcs.net for if you need it.
    Best regards
    Jose Huguet

  25. nino says:

    Hello Andreas, you are Best.
    I do not understand c + + so I used your program readesm.exe.
    I installed and run a file. ddd and gives me this error in the attached and some file .ddd for test.
    I would like to decrypt the files. ddd and do not read the report but only have the file. or ddd. esm clear, can you help me?

  26. Jose Huguet says:

    Hi Andreas,
    I compiled the version svn192, but when I start the application, the following message appears:
    “Could not load internationalization files for your locale: (”
    How can I put the translation to Spanish?
    Thanks.

  27. Andreas Goelzer says:

    Jose: I fixed the missing-first-character bug.
    The first character of the card number was a numeric representation of the country. Invisible for German cards, annoying for Spanish cards, and broke everything for Italian cards. This should now also be fixed in svn.
    I added a spanish translation file, but as I never learned more Spanish than “Mi aerodeslizador está lleno de anguilas” it is mostly empty. If you want, you can add spanish phrases to it using linguist-qt4 (in ubuntu it is in qt4-dev-tools).

    Nino: Thanks for the files, they helped me track down several bugs. Readesm should now be able to read those files, I’ll post a windows binary later.

    If there are more files out there that are unreadable, send them to by email to K_2005@goelzer.de . For reasons of confidentiality, you might want to encrypt them, and because of legal issues you should avoid sending data of recent activities(I believe in Germany everything from up to 2008 should be fine)

  28. Jose Huguet says:

    Hi Andreas,

    I e-mailed the Spanish translation.
    Thanks for everything

  29. Marko says:

    readesm startet nicht unter ubuntu?
    kommt immer error

    Die Datei Muster.DDD ist inOrte-Dokumente – Fahrlinux

    Hier auch
    http://wiki.ubuntuusers.de/Baustelle/Fahrlinux
    Beste Grüße

  30. Zoltan Kiss says:

    Hi Andreas,

    In the “vu11Block.h” you ask for help.

    Read the section “2.2.6. Response message content” in the official PDF on the page 160.

    Best Regards

    Zoltan

  31. Zoltan Kiss says:

    Hi,

    Sorry for the previous, but I don’t read the header file thoughtfully.

    The official PDF contains only the TREP 01-05.

    Best Regards

    Zoltan

  32. Matija says:

    I forgot to inform you about my little IB.TCR (TachoCardReader) app for Windows…
    You can download it here – it has both Croatian and English language support…
    http://tahograf.inter-biz.hr/free/TCRsetup.exe

    It can read data from driver card (using standard smartcard reader installed in Windows) and save it as .ddd (tmp.ddd).
    Additionally, I created a tool (comercial) IB.Taho for data analysis etc. I plan to take a cut from it and make .ddd file reader available for free – it’s finished but I have to translate it…

    If you go direct to this web site, you can download IB.ATR too (for now, only croatian) – it is a tool for reading scanned analog tacho paperdiscs… it tries to read activities from digitized image – works for single or 2x discs on A4…

  33. Andreas Goelzer says:

    Matija: That is great news, a simple solution to read the driver cards with free software was still missing.

    Zoltan: I guess it’s something special, seems to be related to card insertion times, but not sure what the data is. Have to get that tachograph readout script working and then check again.

    Regarding readesm: Mikulás Róbert provided an hungarian translation, if someone needs a compiled version, mail me. Otherwise it’ll be included in the next release in maybe 2 weeks. The code right now really needs to be cleaned up, that will take some time.

  34. Neil Evans says:

    Excellent work! I have downloaded the only version (Croatian?) but do you have an English version also? Your post suggests that you do.

    A great effort and if I can help in any way I will (I have limited development skills).

    Regards,

    Neil

  35. Neil Evans says:

    My apologies! Look first and speak later 😉 I have found the language option!

    Neil

  36. Matija says:

    Please note that current IB.TCR is not signing .ddd files!
    I will try to make this possible in next release…

    For those who didn’t check it – simple Windows solution to download your data from driver card to .ddd file.

  37. Luca says:

    Hi all,
    I like to try this software but I havn’t file .ddd .esm to do this.
    Can anyone to send me this file to test this software?
    thanks

    ANDREAS, THANKS!!!!!!!!!!

  38. Luca says:

    SORRY!! my email address is luca_pl@yahoo.it
    bye

  39. Zoltan says:

    Hi,

    In the readesm 2011.12pre1 the DailyPresenceCounter interpreted as a hex value.
    This is wrong because this is a BCD value.

    Regards

  40. Massimo says:

    Hi Andreas, congratulation for your software, can i give you a contribute for italian translation ?

    If you explain me the simple way to generate a translation file for your software, i can translate from english to italian for you.

    Thanks,

    Massimo

  41. RS says:

    Hi,

    Its possible to change the driversnames in the files without being seen by the government ? I need to change a couple of those.. to be in order by law. I have a control in a couple of weeks.

    Thx

  42. Artur says:

    Andreas,

    I am wondering if you display “VuDataBlockCounter” correctly.
    In the UE documentation is written:
    VuDataBlockCounter::= BCDString(SIZE(2))

    so, IMHO value for 0x0201 would be 201. Your application display “513”.

    I suppose that you interpret this as regular integer.

    Is it correct?

  43. tomas says:

    Hello, Andreas

    thank you for your software
    I didn’t get how to use russian version for windows application.
    Could you help me with this I copied files to program directory, but still it doesn’t work.
    what else must I do, or I missed something?
    Thank you

  44. Luca says:

    Hi Andreas,
    I would like to translate readesm in italian lnguage. Please can you expain how is possible?
    thanks
    Luca

  45. hans says:

    Andreas;
    By opening of files from a Stoneridge tacho the vu downloads (.ddd) will give an error on line 116 at column 33: premature end of document
    This is only with Stoneridge
    How can i solve this

  46. DEK says:

    For Luca.
    Use Qt Linguist.

  47. RG says:

    Hi Andreias,

    Do you know where can I find some .ddd files to use in application testing?

    Thanks in advance.

    Regards,

    RG

  48. Mirza says:

    Hello,

    i am looking for a .ddd file for testing.
    Does anyone have it and can send it via email mirzinho(at)gmail.com.. also any documention on .ddd file structure would be good.

    Thank you

    Cheers

  49. I don’t even know the way I stopped up here, but I thought this put up used to be great.
    I don’t recognise who you are however definitely you
    are going to a famous blogger should you aren’t already.
    Cheers!

  50. Pretty nice post. I just stumbled upon your weblog and wanted to mention that I have truly loved browsing your blog posts.
    In any case I will be subscribing for your feed
    and I am hoping you write once more very soon!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>