# README for IRS_OBU application

### Description
This application was made a part of master thesis on BUT FEEC university by David Kolaja.
It should be deployed on the side of IRS and CPOC as an assistant for the process of remote vehicle stop.

### Dependencies
- libssl-dev library (OpenSSL) (tested 1.1.1f)
- nlohmann-json
- CMake 3.12 or higher (tested 3.16.3)
  - with ninja-build (tested 1.10.0)
- Boost 1.58 or higher (tested on 1.71)
- GeographicLib 1.37 or higher (included in /libraries folder)
- Crypto++ 5.6.1 or higher (included in /libraries folder)

### Build
After dependencies above are met, you can build the project by running these commands:

```bash
PATH_TO_PROJECT="/home/vut-diplomka/CLionProjects/xkolaj03-masters/irs_obu-application/" #an example
cmake -DCMAKE_BUILD_TYPE=Debug -G Ninja -S <PATH_TO_PROJECT> -B <PATH_TO_PROJECT>/cmake-build-debug
```
```bash
cmake --build <PATH_TO_PROJECT>/cmake-build-debug --target irs_obu-application -j 3
```

### Run
After building, in "<PATH_TO_PROJECT>/cmake-build-debug" folder, there's going to be an executable file _**irs_obu-application**_.
It takes some arguments depending which use-case you want to utilize:
* help (h) - shows these input options
* usecase (u) - either IRS or CPOC
* if usecase IRS, then add these options:
  * irs_id (i) - ID of IRS to fill in request for CPOC
  * tv_reg_plate (p) - Registration plate of Target Vehicle
  * cpoc_certificate - certificate file of CPOC (generated by certify tool from Vanetza)
  * irs_PrivKey - PrivateKey file of IRS (generated by certify tool from Vanetza)
* if usecase CPOC, then add these options:
  * irs_certificate - certificate file of IRS (generated by certify tool from Vanetza)
  * cpoc_PrivKey - PrivateKey file of CPOC (generated by certify tool from Vanetza)
  * cpoc_certificate again (so that SignerInfo for AA for IRS can be added)

Run examples (IRS and CPOC):
```bash
./irs_obu-application --usecase irs --irs_PrivKey ownTicket/ticket_sign_key.key --cpoc_certificate aa/aa.cert
```

```bash
./irs_obu-application --usecase cpoc --cpoc_certificate aa/aa.cert --irs_certificate ownTicket/ticket.cert --cpoc_PrivKey aa/aa.key
```

Boost TLS/SSL client and server implmentation:
- https://dens.website/tutorials/cpp-asio/ssl-tls
