Move encrypt code out of UserSettings