added self signed certificate support