private DeviceInfo regenerateKey(String uid,String username) throws DataAccessException {
  log.info("Generating encryption key");
  String encryptionKey=Utilities.generateRandomString();
  if (deviceAuthenticator.registerDevice(uid,encryptionKey,username)) {
    return deviceAuthenticator.getDeviceInfo(uid);
  }
  return null;
}

private DeviceInfo regenerateKey ( String uid , String username ) throws DataAccessException { log . info ( "Generating encryption key" ) ; String encryptionKey = Utilities . generateRandomString ( ) ; if ( deviceAuthenticator . registerDevice ( uid , encryptionKey , username ) ) { return deviceAuthenticator . getDeviceInfo ( uid ) ; } return null ; }
this method regenerates the key each time . it lookups up device details of a registered device . also registers device if it is not already registered .
