add cert/key modify the code to be object-oriented