Refactored the generate_certificates script.
Now it should be easier to test and maintain.
Added unicode conversion to User.
It proved to be problematic beforehand causing issues with non-UTF8 databases.