예제 #1
0
  /**
   * * Initializes the scheme
   *
   * @param password user given password
   * @return
   */
  public static boolean initScheme(String password, long[] features) {
    Position[] positions = new Position[Constants.M];
    Arrays.fill(
        positions,
        Position
            .BOTH); /* Initially both Alpha and Beta positions are filled with correct entries */
    BigInteger hpwd = Generator.getHPWD(Constants.Q); /* generate a random hardened password */

    initFunctions(password);

    HistoryData histData = new HistoryData(features);
    histData.persist(new File(Constants.HISTORY_FILE_PATH), hpwd);
    generateScheme(hpwd, positions, password);

    LoginHandler.getPreferences().put(Constants.PREF_INITIALIZED, "true");
    return true;
  }
예제 #2
0
  /**
   * @param password
   * @param features : array of current login features
   * @return true if successfully authenticated
   */
  private static boolean _authenticate(String password, long[] features) {
    initFunctions(password);

    BigInteger hpwd = extractHardenedPwd(features, password);

    File historyFile = new File(Constants.HISTORY_FILE_PATH);

    HistoryData historyData = HistoryData.loadHistory(historyFile, hpwd);
    if (historyData == null) {
        /* returns null if decryption of history file fails*/
      return false;
    }

    historyData.addEntry(features);
    Position[] positions = computeDistFeatures(historyData);

    historyData.persist(historyFile, hpwd);
    generateScheme(hpwd, positions, password);

    return true;
  }