Refactor encrypt util class in preparation for forge support.