Fixed key generation and public key serialization.
Now payload message is serialized (it can be encrypted).