Refactored certificate support.