コード例 #1
0
  public Server(int port) {
    enc = null;
    dec = null;
    char[] password = null;
    char[] passwordcopy = null;
    try {
      password = PrivateKeyHandler.checkPassword(GenerateKeys.getPasswordInput());
      if (password == null) {
        System.err.println("Please enter admin password to start the server");
        System.exit(1);
      }
      passwordcopy = Arrays.copyOf(password, password.length);
      this.network = new ServerNetworkWrapper(port, password);
      dec = LoginManager.load(password);
      enc = LoginManager.save(passwordcopy);
    } finally {
      if (password != null) {
        for (int i = 0; i < password.length; i++) {
          password[i] = '\0';
          passwordcopy[i] = '\0';
        }
      }
    } // In-case LoginManager.load isn't reached

    challengeHanlder = new ChallengeHandler();
  }