Some issues resolved (from sonar)

Signed-off-by: Nico Rutishauser <nr@hotmail.ch>
Added required curly braces

Signed-off-by: Nico Rutishauser <nr@hotmail.ch>
Factor out the file sync step

and improve the SessionParams object

Signed-off-by: Nico Rutishauser <nr@hotmail.ch>
Add documentation of synchronization, adapt tests slightly

Signed-off-by: Nico Rutishauser <nr@hotmail.ch>
Use encryption injection for messages as well

Signed-off-by: Nico Rutishauser <nr@hotmail.ch>