Refactor and clean up Security Util and auto certificates