Generation of keys separated

Improvements: generation of keypairs, logging and signing.