improve tls support

add wrapping of platform tls api