smarter ssl functions