split some security related functions in their own files.