Decode and verify tachograph data (VU data and driver card data).
Inpired by ReadESM and Go Tachograph Card / Parse tacho's card file, but developed from scratch based on the specs.
For proper data verification, the public keys (root ca and member states) are required.
The Python scripts pks1/dl_all_pks1.py and pks2/dl_all_pks2.py download and rename all available public keys, first generation (digital tachograph) public keys are expected to be in pks1, second generation (smart tachograph) public keys are expected in pks2.
cd pks1
./dl_all_pks1.py
cd ..
cd pks2
./dl_all_pks2.py
cd ..Alternatively, they can be downloaded manually from ERCA certificates DT and ERCA certificates ST, but have to be renamed to their certificate reference (resp. unzipped in case of the root certificate) in this case.
In the root directory, execute
./build-binaries-prod.shAlternatively, execute
go mod vendorAnd then change the working directory to cmd/dddparser (or any of the other subdirectories of cmd/) and execute
go build .The project aims to have as little external dependencies as possible, currently there are the following external dependencies (most of them are actually not strictly required and could be removed with little effort):
- brainpool elliptic curve definitions (go-crypto)
- character mappings (x/text)
- hashicorp consul api
- hashicorp sockaddr
- zenity (ui)
- gRPC
- protobuf
- statsd
The executables that are build are the following:
dddparseris the main executable which parses tachograph / driver card data into a json structure.dddsimpleis a very simplified version which only extracts the identification numbers and driver namesddduiis a basic UI for dddparser (select an input tacho file, select an output json file, select the file type (VU or card))dddserveris a gRPC server for tachograph file parsingdddclientis a basic gRPC client which connects to the dddserver
The Dockerfile in the main directory will create a docker image containing only the dddserver executable.
There are unit tests for decoding different data types. To run, type
go testPut the executable cmd/dddparser/dddparser to a location that is in your PATH, f.e.
sudo cp cmd/dddparser/dddparser /usr/local/binThe executable dddparser reads raw data from STDIN and outputs JSON data to STDOUT, warnings and errors are sent to STDERR.
dddparser requires one parameter option, which has to be either -card or -vu depending on the type of data (-card is for driver card data, -vu is for vehicle unit data).
Example:
cat tachodata.ddd | ./dddparser -vuThe executable dddsimple reads raw data from STDIN and outputs JSON data to STDOUT, warnings and errors are sent to STDERR.
dddsimple has one optional argument -card which indicates that the input data is driver card data, if not given, it is assumed to be vehicle unit data.
Example:
cat driverdata.ddd | ./dddsimple -cardThe executable dddserver starts a gRPC server which listens on port 50055 for incoming requests. The server can be started with the following command:
./dddserverTo change the port, use the -listen option:
./dddserver -listen :50056For output formatting and further processing, jq is recommended, f.e.:
cat tachodata.ddd | dddparser -vu | jq . | less- parse 1st generation driver card data
- parse 2nd generation driver card data
- parse 2nd generation v2 driver card data
- parse 1st generation vu data
- parse 2nd generation vu data
- parse 2nd generation v2 vu data
- signature verification 1st generation
- signature verification 2nd generation
- complete unit tests for all data types