Refactored security specific code out to crypto package.