summaryrefslogtreecommitdiff
path: root/src/gui/dialogs
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2017-02-19 11:55:28 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2017-02-19 11:55:28 (GMT)
commit588c206289a84bfc939ac27dacba991d9b6d0793 (patch)
tree0de656a445e236de1846e8f40e6635077b9d3f19 /src/gui/dialogs
parent1898c6ea16d0eee8ecc5ab9ebb26ac91ad7314b4 (diff)
Created client/server certificates on demand for a given identity.
Diffstat (limited to 'src/gui/dialogs')
-rw-r--r--src/gui/dialogs/Makefile.am4
-rw-r--r--src/gui/dialogs/gresource.xml3
-rw-r--r--src/gui/dialogs/identity.c189
-rw-r--r--src/gui/dialogs/identity.h37
-rw-r--r--src/gui/dialogs/identity.ui278
5 files changed, 510 insertions, 1 deletions
diff --git a/src/gui/dialogs/Makefile.am b/src/gui/dialogs/Makefile.am
index e1774d7..bb2087b 100644
--- a/src/gui/dialogs/Makefile.am
+++ b/src/gui/dialogs/Makefile.am
@@ -4,7 +4,8 @@ BUILT_SOURCES = resources.h resources.c
noinst_LTLIBRARIES = libguidialogs.la
UI_FILES = \
- binadmin.ui
+ binadmin.ui \
+ identity.ui
libguidialogs_la_SOURCES = \
about.h about.c \
@@ -12,6 +13,7 @@ libguidialogs_la_SOURCES = \
export.h export.c \
goto.h goto.c \
gotox.h gotox.c \
+ identity.h identity.c \
plugins.h plugins.c \
resources.h resources.c \
shellcode.h shellcode.c \
diff --git a/src/gui/dialogs/gresource.xml b/src/gui/dialogs/gresource.xml
index 913b830..d1ba8b6 100644
--- a/src/gui/dialogs/gresource.xml
+++ b/src/gui/dialogs/gresource.xml
@@ -3,4 +3,7 @@
<gresource prefix="/org/chrysalide/gui/dialogs">
<file compressed="true">binadmin.ui</file>
</gresource>
+ <gresource prefix="/org/chrysalide/gui/dialogs">
+ <file compressed="true">identity.ui</file>
+ </gresource>
</gresources>
diff --git a/src/gui/dialogs/identity.c b/src/gui/dialogs/identity.c
new file mode 100644
index 0000000..0f6a111
--- /dev/null
+++ b/src/gui/dialogs/identity.c
@@ -0,0 +1,189 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * identity.c - (re)définition de l'identité de l'utilisateur
+ *
+ * Copyright (C) 2017 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chrysalide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "identity.h"
+
+
+#include <string.h>
+
+
+#include <i18n.h>
+
+
+#include "../panels/log.h"
+#include "../../analysis/db/keymgn.h"
+
+
+
+/* Applique la nouvelle définition d'identité. */
+static void update_identity(GtkButton *button, GtkBuilder *);
+
+
+
+/******************************************************************************
+* *
+* Paramètres : parent = fenêtre principale de l'éditeur. *
+* outb = constructeur à détruire après usage. [OUT] *
+* *
+* Description : Propose une édition des informations conernant l'utilisateur.*
+* *
+* Retour : Adresse de la fenêtre mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GtkWidget *create_identity_dialog(GtkWindow *parent, GtkBuilder **outb)
+{
+ GtkWidget *result; /* Fenêtre à renvoyer */
+ GtkBuilder *builder; /* Constructeur utilisé */
+ x509_entries entries; /* Eléments identitaires */
+ GtkEntry *entry; /* Zone de saisie à initialiser*/
+
+ builder = gtk_builder_new_from_resource("/org/chrysalide/gui/dialogs/identity.ui");
+ *outb = builder;
+
+ result = GTK_WIDGET(gtk_builder_get_object(builder, "window"));
+
+ gtk_window_set_transient_for(GTK_WINDOW(result), parent);
+
+ /* Mise à jour de l'interface */
+
+ load_identity(true, &entries);
+
+ if (entries.country != NULL)
+ {
+ entry = GTK_ENTRY(gtk_builder_get_object(builder, "c"));
+ gtk_entry_set_text(entry, entries.country);
+ }
+
+ if (entries.state != NULL)
+ {
+ entry = GTK_ENTRY(gtk_builder_get_object(builder, "st"));
+ gtk_entry_set_text(entry, entries.state);
+ }
+
+ if (entries.locality != NULL)
+ {
+ entry = GTK_ENTRY(gtk_builder_get_object(builder, "l"));
+ gtk_entry_set_text(entry, entries.locality);
+ }
+
+ if (entries.organisation != NULL)
+ {
+ entry = GTK_ENTRY(gtk_builder_get_object(builder, "o"));
+ gtk_entry_set_text(entry, entries.organisation);
+ }
+
+ if (entries.organisational_unit != NULL)
+ {
+ entry = GTK_ENTRY(gtk_builder_get_object(builder, "ou"));
+ gtk_entry_set_text(entry, entries.organisational_unit);
+ }
+
+ if (entries.country != NULL)
+ {
+ entry = GTK_ENTRY(gtk_builder_get_object(builder, "cn"));
+ gtk_entry_set_text(entry, entries.common_name);
+
+ gtk_editable_select_region(GTK_EDITABLE(entry), 0, -1);
+
+ }
+
+ /* Connexion des signaux */
+
+ gtk_builder_add_callback_symbols(builder,
+ "update_identity", G_CALLBACK(update_identity),
+ NULL);
+
+ gtk_builder_connect_signals(builder, builder);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : button = bouton à l'origine de la procédure. *
+* builder = espace de référencement global. *
+* *
+* Description : Applique la nouvelle définition d'identité. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void update_identity(GtkButton *button, GtkBuilder *builder)
+{
+ GtkEntry *entry; /* Zone de saisie à consulter */
+ const gchar *data; /* Données internes à GTK */
+ x509_entries entries; /* Nouvelle identité à pousser */
+ bool status; /* Bilan de la mise à jour */
+
+ /* Récupération des éléments */
+
+ entry = GTK_ENTRY(gtk_builder_get_object(builder, "c"));
+ data = gtk_entry_get_text(entry);
+
+ entries.country = (strlen(data) > 0 ? strdup(data) : NULL);
+
+ entry = GTK_ENTRY(gtk_builder_get_object(builder, "st"));
+ data = gtk_entry_get_text(entry);
+
+ entries.state = (strlen(data) > 0 ? strdup(data) : NULL);
+
+ entry = GTK_ENTRY(gtk_builder_get_object(builder, "l"));
+ data = gtk_entry_get_text(entry);
+
+ entries.locality = (strlen(data) > 0 ? strdup(data) : NULL);
+
+ entry = GTK_ENTRY(gtk_builder_get_object(builder, "o"));
+ data = gtk_entry_get_text(entry);
+
+ entries.organisation = (strlen(data) > 0 ? strdup(data) : NULL);
+
+ entry = GTK_ENTRY(gtk_builder_get_object(builder, "ou"));
+ data = gtk_entry_get_text(entry);
+
+ entries.organisational_unit = (strlen(data) > 0 ? strdup(data) : NULL);
+
+ entry = GTK_ENTRY(gtk_builder_get_object(builder, "cn"));
+ data = gtk_entry_get_text(entry);
+
+ entries.common_name = (strlen(data) > 0 ? strdup(data) : NULL);
+
+ /* Application de la nouvelle définition */
+
+ status = register_standalone_certs(&entries);
+
+ free_x509_entries(&entries);
+
+ if (status)
+ log_simple_message(LMT_INFO, _("New identity has been loaded with success!"));
+ else
+ log_simple_message(LMT_ERROR, _("Failure while loading the new identity..."));
+
+}
diff --git a/src/gui/dialogs/identity.h b/src/gui/dialogs/identity.h
new file mode 100644
index 0000000..2019eba
--- /dev/null
+++ b/src/gui/dialogs/identity.h
@@ -0,0 +1,37 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * identity.h - prototypes pour la (re)définition de l'identité de l'utilisateur
+ *
+ * Copyright (C) 2017 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chrysalide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _GUI_DIALOGS_IDENTITY_H
+#define _GUI_DIALOGS_IDENTITY_H
+
+
+#include <gtk/gtk.h>
+
+
+
+/* Propose une édition des informations conernant l'utilisateur. */
+GtkWidget *create_identity_dialog(GtkWindow *, GtkBuilder **);
+
+
+
+#endif /* _GUI_DIALOGS_IDENTITY_H */
diff --git a/src/gui/dialogs/identity.ui b/src/gui/dialogs/identity.ui
new file mode 100644
index 0000000..f622a91
--- /dev/null
+++ b/src/gui/dialogs/identity.ui
@@ -0,0 +1,278 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.18.3 -->
+<interface>
+ <requires lib="gtk+" version="3.12"/>
+ <object class="GtkDialog" id="window">
+ <property name="width_request">515</property>
+ <property name="can_focus">False</property>
+ <property name="title" translatable="yes">Identity</property>
+ <property name="modal">True</property>
+ <property name="window_position">center</property>
+ <property name="default_width">515</property>
+ <property name="type_hint">dialog</property>
+ <child internal-child="vbox">
+ <object class="GtkBox" id="dialog-vbox1">
+ <property name="can_focus">False</property>
+ <property name="valign">start</property>
+ <property name="margin_left">8</property>
+ <property name="margin_right">8</property>
+ <property name="margin_top">8</property>
+ <property name="margin_bottom">8</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox" id="dialog-action_area1">
+ <property name="can_focus">False</property>
+ <property name="margin_top">8</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="button1">
+ <property name="label">gtk-cancel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ <property name="always_show_image">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button2">
+ <property name="label">gtk-apply</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ <property name="always_show_image">True</property>
+ <signal name="clicked" handler="update_identity" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid" id="grid1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="row_spacing">8</property>
+ <property name="column_spacing">8</property>
+ <child>
+ <object class="GtkSeparator" id="separator1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_left">8</property>
+ <property name="margin_right">8</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="width_request">500</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">All the following information is used to create your authentication certifcate. This certificate grants you access to database servers and identifies each analysis change.
+
+&lt;b&gt;Warning: &lt;/b&gt; updating this information drives to new signing requests for remote servers!</property>
+ <property name="use_markup">True</property>
+ <property name="wrap">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Common name (required):</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="cn">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSeparator" id="separator3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_left">8</property>
+ <property name="margin_right">8</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ <property name="width">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Organisational unit:</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="ou">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="o">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Organisation:</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSeparator" id="separator4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_left">8</property>
+ <property name="margin_right">8</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">6</property>
+ <property name="width">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Locality:</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">7</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="l">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">7</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="st">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">8</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">State:</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">8</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label7">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Country (two letters):</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">9</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="c">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">9</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-6">button1</action-widget>
+ <action-widget response="-10">button2</action-widget>
+ </action-widgets>
+ </object>
+</interface>