refactoring for local cert generation