Full function.
Encode and decode function.
For header use always (hard code) cipher aes-128-cbc.