added support for self-signing certificates