コード例 #1
0
  /**
   * Initialize X509 certificate settings. Read settings from database, fallback reading from
   * property file if settings could not be read from database.
   */
  public void initializeX509() {

    this.X509_ROOT_SUBJECT = ConfigurationQueries.getValue(ConfigurationQueries.X509_ROOT_SUBJECT);
    this.X509_ROOT_VALID_FROM =
        ConfigurationQueries.getValue(ConfigurationQueries.X509_ROOT_VALID_FROM);
    this.X509_ROOT_VALID_TO =
        ConfigurationQueries.getValue(ConfigurationQueries.X509_ROOT_VALID_TO);
    this.X509_SERVER_SUBJECT =
        ConfigurationQueries.getValue(ConfigurationQueries.X509_SERVER_SUBJECT);
    this.X509_SERVER_VALID_FOR =
        ConfigurationQueries.getValue(ConfigurationQueries.X509_SERVER_VALID_FOR);
    this.X509_SERVER_VALID_FROM =
        ConfigurationQueries.getValue(ConfigurationQueries.X509_SERVER_VALID_FROM);
    this.X509_CLIENT_SUBJECT =
        ConfigurationQueries.getValue(ConfigurationQueries.X509_CLIENT_SUBJECT);
    this.X509_CLIENT_VALID_FOR =
        ConfigurationQueries.getValue(ConfigurationQueries.X509_CLIENT_VALID_FOR);
    this.X509_CLIENT_VALID_FROM =
        ConfigurationQueries.getValue(ConfigurationQueries.X509_CLIENT_VALID_FROM);
    this.X509_KEY_STRENGTH = ConfigurationQueries.getValue(ConfigurationQueries.X509_KEY_STRENGTH);

    ResourceBundle rootCertBundle = null;
    ResourceBundle serverCertBundle = null;
    ResourceBundle clientCertBundle = null;
    try {
      rootCertBundle = ResourceBundle.getBundle(Constants.ROOT_BUNDLE_NAME);
      serverCertBundle = ResourceBundle.getBundle(Constants.SERVER_BUNDLE_NAME);
      clientCertBundle = ResourceBundle.getBundle(Constants.CLIENT_BUNDLE_NAME);

      if (this.X509_ROOT_SUBJECT == null || "".equals(this.X509_ROOT_SUBJECT))
        this.X509_ROOT_SUBJECT = rootCertBundle.getString("subject");
      if (this.X509_ROOT_VALID_FROM == null || "".equals(this.X509_ROOT_VALID_FROM))
        this.X509_ROOT_VALID_FROM = formatStartDate(rootCertBundle.getString("startDate"));
      if (this.X509_ROOT_VALID_TO == null || "".equals(this.X509_ROOT_VALID_TO))
        this.X509_ROOT_VALID_TO = formatEndDate(rootCertBundle.getString("endDate"));

      if (this.X509_SERVER_SUBJECT == null || "".equals(this.X509_SERVER_SUBJECT))
        this.X509_SERVER_SUBJECT = serverCertBundle.getString("subject");
      if (this.X509_SERVER_VALID_FROM == null || "".equals(this.X509_SERVER_VALID_FROM))
        this.X509_SERVER_VALID_FROM = formatStartDate(serverCertBundle.getString("startDate"));
      if (this.X509_SERVER_VALID_FOR == null || "".equals(this.X509_SERVER_VALID_FOR))
        this.X509_SERVER_VALID_FOR = Integer.toString(Constants.DEFAULT_SERVER_CERT_VALIDITY);

      if (this.X509_CLIENT_SUBJECT == null || "".equals(this.X509_CLIENT_SUBJECT))
        this.X509_CLIENT_SUBJECT = clientCertBundle.getString("subject");
      if (this.X509_CLIENT_VALID_FROM == null || "".equals(this.X509_CLIENT_VALID_FROM))
        this.X509_CLIENT_VALID_FROM = formatStartDate(clientCertBundle.getString("startDate"));
      if (this.X509_CLIENT_VALID_FOR == null || "".equals(this.X509_CLIENT_VALID_FOR))
        this.X509_CLIENT_VALID_FOR = Integer.toString(Constants.DEFAULT_CLIENT_CERT_VALIDITY);

      if (this.X509_KEY_STRENGTH == null || "".equals(this.X509_KEY_STRENGTH))
        this.X509_KEY_STRENGTH = rootCertBundle.getString("key_strength");

    } catch (MissingResourceException mre) {
      logger.log(Level.SEVERE, "Error: *_cert.properties could not be read", mre);
    }
  }
コード例 #2
0
 /**
  * Sets the status, if the default database or an external database will be used
  *
  * @param defaultDB true, if the default database will be used
  */
 public void setUseDefaultDB(boolean defaultDB) {
   this.USE_DEFAULT_DB = defaultDB;
   ConfigurationQueries.setValue(
       ConfigurationQueries.USE_DEFAULT_DB,
       defaultDB + "",
       DBConnector.getInstance().getBaseConnection());
 }
コード例 #3
0
  /**
   * Helper Function to initialize Window Positioning
   *
   * @param query the query for the db
   * @param fallback_pos fallback value for position
   * @param screen size of the screen
   * @return the position for the window
   */
  private int setWindowPosition(String query, int fallback_pos, int screen) {
    int pos;
    String get_pos = ConfigurationQueries.getValue(query);
    if (!StringUtils.isEmptyOrWhitespaces(get_pos)) pos = Integer.parseInt(get_pos);
    else pos = fallback_pos;

    if (pos > screen) {
      pos = fallback_pos;
    }

    return pos;
  }
コード例 #4
0
 public void setGuiShowOpenVPNIpWarningDialog(boolean show) {
   ConfigurationQueries.setValue(
       ConfigurationQueries.GUI_SHOW_OPENVPN_IP_WARNING_DIALOG, show + "");
   this.GUI_SHOW_OPENVPN_IP_WARNING = show;
 }
コード例 #5
0
 public void setGuiShowExitDialog(boolean showExitDialog) {
   ConfigurationQueries.setValue(ConfigurationQueries.GUI_SHOW_EXIT_DIALOG, showExitDialog + "");
   this.GUI_SHOW_EXIT_DIALOG = showExitDialog;
 }
コード例 #6
0
 public void setGuiShowCRL(boolean showCRL) {
   ConfigurationQueries.setValue(ConfigurationQueries.GUI_SHOW_CRL_TAB, showCRL + "");
   this.GUI_SHOW_CRL_TAB = showCRL;
 }
コード例 #7
0
 public void setX509GuiLocationY(int locationY) {
   ConfigurationQueries.setValue(ConfigurationQueries.X509_GUI_LOCATION_Y, locationY + "");
   this.X509_GUI_LOCATION_Y = locationY;
 }
コード例 #8
0
 public void setX509GuiWidth(int width) {
   ConfigurationQueries.setValue(ConfigurationQueries.X509_GUI_WIDTH, width + "");
   this.X509_GUI_WIDTH = width;
 }
コード例 #9
0
 public void setUpdateProxyPassword(String proxyPassword) {
   ConfigurationQueries.setValue(ConfigurationQueries.UPDATE_PROXY_PASSWORD, proxyPassword);
   UDPATE_PROXY_PASSWORD = proxyPassword;
 }
コード例 #10
0
 public void setX509ClientSubject(String x509_client_subject) {
   ConfigurationQueries.setValue(ConfigurationQueries.X509_CLIENT_SUBJECT, x509_client_subject);
   this.X509_CLIENT_SUBJECT = x509_client_subject;
 }
コード例 #11
0
 public void setX509ServerValidFor(String x509_server_valid_for) {
   ConfigurationQueries.setValue(
       ConfigurationQueries.X509_SERVER_VALID_FOR, x509_server_valid_for);
   this.X509_SERVER_VALID_FOR = x509_server_valid_for;
 }
コード例 #12
0
 public void setX509ServerValidFrom(String x509_server_valid_from) {
   ConfigurationQueries.setValue(
       ConfigurationQueries.X509_SERVER_VALID_FROM, x509_server_valid_from);
   this.X509_SERVER_VALID_FROM = x509_server_valid_from;
 }
コード例 #13
0
 public void setX509ServerSubject(String x509_server_subject) {
   ConfigurationQueries.setValue(ConfigurationQueries.X509_SERVER_SUBJECT, x509_server_subject);
   this.X509_SERVER_SUBJECT = x509_server_subject;
 }
コード例 #14
0
 public void setX509RootValidTo(String x509_root_valid_to) {
   ConfigurationQueries.setValue(ConfigurationQueries.X509_ROOT_VALID_TO, x509_root_valid_to);
   this.X509_ROOT_VALID_TO = x509_root_valid_to;
 }
コード例 #15
0
 public void setX509RootValidFrom(String x509_root_valid_from) {
   ConfigurationQueries.setValue(ConfigurationQueries.X509_ROOT_VALID_FROM, x509_root_valid_from);
   this.X509_ROOT_VALID_FROM = x509_root_valid_from;
 }
コード例 #16
0
 public void setUpdateProxyPort(String proxyPort) {
   ConfigurationQueries.setValue(ConfigurationQueries.UPDATE_PROXY_PORT, proxyPort);
   UPDATE_PROXY_PORT = proxyPort;
 }
コード例 #17
0
 public void setUpdateProxyUsername(String proxyUsername) {
   ConfigurationQueries.setValue(ConfigurationQueries.UPDATE_PROXY_USERNAME, proxyUsername);
   UPDATE_PROXY_USERNAME = proxyUsername;
 }
コード例 #18
0
 public void setX509ClientValidFrom(String x509_client_valid_from) {
   ConfigurationQueries.setValue(
       ConfigurationQueries.X509_CLIENT_VALID_FROM, x509_client_valid_from);
   this.X509_CLIENT_VALID_FROM = x509_client_valid_from;
 }
コード例 #19
0
 public void setX509GuiHeight(int height) {
   ConfigurationQueries.setValue(ConfigurationQueries.X509_GUI_HEIGHT, height + "");
   this.X509_GUI_HEIGHT = height;
 }
コード例 #20
0
 public void setX509ClientValidFor(String x509_client_valid_for) {
   ConfigurationQueries.setValue(
       ConfigurationQueries.X509_CLIENT_VALID_FOR, x509_client_valid_for);
   this.X509_CLIENT_VALID_FOR = x509_client_valid_for;
 }
コード例 #21
0
 public void setX509GuiLocationX(int locationX) {
   ConfigurationQueries.setValue(ConfigurationQueries.X509_GUI_LOCATION_X, locationX + "");
   this.X509_GUI_LOCATION_X = locationX;
 }
コード例 #22
0
 public void setX509KeyStrength(String x509_key_strength) {
   ConfigurationQueries.setValue(ConfigurationQueries.X509_KEY_STRENGTH, x509_key_strength);
   this.X509_KEY_STRENGTH = x509_key_strength;
 }
コード例 #23
0
 public void setServerUserTreeDividerLocation(int serverUserTreeDividerLocation) {
   ConfigurationQueries.setValue(
       ConfigurationQueries.SERVER_USER_TREE_DIVIDER_LOCATION, serverUserTreeDividerLocation + "");
   this.SERVER_USER_TREE_DIVIDER_LOCATION = serverUserTreeDividerLocation;
 }
コード例 #24
0
 public void setUpdateAutomatically(boolean autoUpdate) {
   ConfigurationQueries.setValue(ConfigurationQueries.UPDATE_AUTOMATICALLY, autoUpdate + "");
   UPDATE_AUTOMATICALLY = autoUpdate;
 }
コード例 #25
0
 public void setGuiShowCRX509(boolean crX509) {
   ConfigurationQueries.setValue(ConfigurationQueries.GUI_SHOW_CR_X509, crX509 + "");
   this.GUI_SHOW_CR_X509 = crX509;
 }
コード例 #26
0
 public void setUpdateServerPath(String path) {
   ConfigurationQueries.setValue(ConfigurationQueries.UPDATE_SERVER_PATH, path);
   UPDATE_SERVER = path;
 }
コード例 #27
0
 public void setGuiShowExitDialogActiveThreads(boolean showExitDialogActiveThreads) {
   ConfigurationQueries.setValue(
       ConfigurationQueries.GUI_SHOW_EXIT_DIALOG_ACTIVE_THREADS, showExitDialogActiveThreads + "");
   this.GUI_SHOW_EXIT_DIALOG_ACTIVE_THREADS = showExitDialogActiveThreads;
 }
コード例 #28
0
 public void setUpdateRepository(String repo) {
   ConfigurationQueries.setValue(ConfigurationQueries.UPDATE_REPOSITORY, repo);
   UPDATE_REPOSITORY = repo;
 }
コード例 #29
0
 public void setCreateOpenVPNConfigFiles(boolean createOpenVPNConfigFiles) {
   ConfigurationQueries.setValue(
       ConfigurationQueries.CREATE_OPENVPN_CONFIG_FILES, createOpenVPNConfigFiles + "");
   this.CREATE_OPENVPN_CONFIG_FILES = createOpenVPNConfigFiles;
 }
コード例 #30
0
 public void setUpdateProxy(String proxy) {
   ConfigurationQueries.setValue(ConfigurationQueries.UPDATE_PROXY, proxy);
   UPDATE_PROXY = proxy;
 }