Refactoring to crypto-keyczar