Refactor crypto interface.