Client Certificate support for TLS

This patch solves issue #1760 . It makes it easy to program very advanced client certificate support. 
This is against the master branch.