Allow check ssl certificate
Many improvements and pass unit tests