proper ssl generation, pulled from gist