Implementing basic TLS support