Refactored certificate creation. No works with Mac