Certificate/pkey generation & PEM export

Required quite a lot of refactoring
Addressed review comments

- fixed invalid file permissions

- removed redundand mem::transmute

- removed outdated FIXME's

- removed redundand temporary variable

- removed macro_export for internal macros
Merge pull request #53 from vhbit/cert-gen

Certificate/PKey generation & PEM export