refactoring encrypted creds