Merged self-signed certificate generation

Did it.

Update:
Fixed issues mentioned by @archSeer.
Renamed it and rebased against `master`.