Improve SSL setup code and make protocols and ciphers configurable