Esempio n. 1
0
        /// <summary>
        /// Action lors du clic sur le label "lbl_scrNoteUpdate".
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void lbl_scrNoteUpdate_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            Label  clickedLabel = sender as Label;
            string scrNoteID    = clickedLabel.Name.Substring(10);

            List <string> scrNoteName            = VaultDatabase.GetScrNoteNameList(scrNoteID);
            List <byte[]> scrNoteCipheredContent = VaultDatabase.GetScrNoteContentList(scrNoteID);
            List <string> scrNotePlainContent    = PlainData(scrNoteCipheredContent);
            bool          scrNoteBookmark        = VaultDatabase.GetScrNoteBookmark(scrNoteID);
            List <string> scrNoteCrtDate         = VaultDatabase.GetScrNoteCrtDate(scrNoteID);
            List <string> scrNoteChgDate         = VaultDatabase.GetScrNoteChgDate(scrNoteID);
            List <string> scrNoteCategory        = VaultDatabase.GetScrNoteCategory(scrNoteID);

            List <string> scrNoteData = new List <string>();

            scrNoteData.Add(scrNoteName[0]);
            scrNoteData.Add(scrNotePlainContent[0]);
            scrNoteData.Add(scrNoteBookmark.ToString());
            scrNoteData.Add(scrNoteCrtDate[0]);
            scrNoteData.Add(scrNoteChgDate[0]);
            scrNoteData.Add(scrNoteCategory[0]);
            scrNoteData.Add(scrNoteID);

            usc_scrNote usc_noteHome = new usc_scrNote(scrNoteData);

            Switcher.Switch(usc_noteHome);

            return;
        }
Esempio n. 2
0
        /// <summary>
        /// Action lors du clic sur le label "lbl_scrNoteDelete".
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void lbl_scrNoteDelete_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            Label  clickedLabel = sender as Label;
            string scrNoteID    = clickedLabel.Name.Substring(10);

            System.Windows.Forms.DialogResult dialogResult = System.Windows.Forms.MessageBox.Show(Data_Home.Default.lbl_MenuItemDelete_Click_Message_ScrNote,
                                                                                                  Data_Home.Default.lbl_MenuItemDelete_Click_Title_ScrNote,
                                                                                                  System.Windows.Forms.MessageBoxButtons.YesNo);

            if (dialogResult == System.Windows.Forms.DialogResult.Yes)
            {
                // Vérifie l'exécution de la suppression du de la note sécurisée.
                if (VaultDatabase.DeleteScrNote(scrNoteID))
                {
                    // Affiche l'interface d'accueil.
                    usc_home usc_homeHome = new usc_home();
                    Switcher.Switch(usc_homeHome);
                    return;
                }
                else
                {
                    System.Windows.Forms.MessageBox.Show(Data_VaultDatabase.Default.DeleteScrNote);
                    return;
                }
            }
            else
            {
                // Affiche l'interface d'accueil.
                usc_home usc_homeHome = new usc_home();
                Switcher.Switch(usc_homeHome);
                return;
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Initialise une nouvelle instance de la classe usc_authenCard.
        /// </summary>
        public usc_authenCard(List <string> _authenCardData = null)
        {
            InitializeComponent();

            // Modifie la fenêtre principale et l'interface courante.
            Switcher.ChangeWindowTitle(Data_AuthenCard.Default.AuthenCardTitle);
            cbo_category.ItemsSource = VaultDatabase.GetCategoryNameList();

            AuthenCard.ACardData = _authenCardData;

            if (AuthenCard.ACardData == null)
            {
                AuthenCard.UpdateDateAndCtgControls(lbl_crtDateValue, lbl_chgDateValue, cbo_category);
                return;
            }
            else
            {
                // Assigne à des champs de saisie, les valeurs récupérées pour la modification de la fiche d'authentification.
                txt_name.Text     = AuthenCard.ACardData[0];
                txt_shortcut.Text = AuthenCard.ACardData[1];
                txt_username.Text = AuthenCard.ACardData[2];
                txt_password.Text = AuthenCard.ACardData[3];
                txt_scrNote.Text  = AuthenCard.ACardData[4];
                chk_bmk.IsChecked = Convert.ToBoolean(AuthenCard.ACardData[5]);

                // Assigne à des étiquette, seulement la date.
                lbl_chgDateValue.Content = AuthenCard.ACardData[6].Substring(0, 10);
                lbl_crtDateValue.Content = AuthenCard.ACardData[7].Substring(0, 10);

                // Assigne à une liste déroulante, un élément sélectionné par défaut.
                cbo_category.SelectedIndex = Convert.ToInt32(AuthenCard.ACardData[8]) - 1;
                return;
            }
        }
        /// <summary>
        /// Action lors du clic sur le menuItem supprimer du contextMenu du label "lbl_stpCategory".
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void lbl_MenuItemDelete_Click(object sender, RoutedEventArgs e)
        {
            MenuItem clickedMenuItem = sender as MenuItem;
            string   categoryName    = clickedMenuItem.Header.ToString().Substring(10);

            System.Windows.Forms.DialogResult dialogResult = System.Windows.Forms.MessageBox.Show(Data_Home.Default.lbl_MenuItemDelete_Click_Message_Category,
                                                                                                  Data_Home.Default.lbl_MenuItemDelete_Click_Title_Category,
                                                                                                  System.Windows.Forms.MessageBoxButtons.YesNo);

            if (dialogResult == System.Windows.Forms.DialogResult.Yes)
            {
                // Vérifie l'exécution de la suppression du de la catégorie.
                if (VaultDatabase.DeleteCategory(categoryName))
                {
                    // Affiche l'interface d'accueil.
                    usc_home usc_homeHome = new usc_home();
                    Switcher.Switch(usc_homeHome);
                    return;
                }
                else
                {
                    System.Windows.Forms.MessageBox.Show(Data_VaultDatabase.Default.DeleteCategory);
                    return;
                }
            }
            else
            {
                // Affiche l'interface d'accueil.
                usc_home usc_homeHome = new usc_home();
                Switcher.Switch(usc_homeHome);
                return;
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Initialise une nouvelle instance de la classe usc_home.
        /// </summary>
        public usc_home(string _categoryName = "Tous les éléments", string _bookmark = "")
        {
            InitializeComponent();

            Switcher.ChangeWindowTitle(Data_Home.Default.HomeTitle);

            string categoryName = _categoryName;
            string bookmark     = _bookmark;
            int    allItermNbr  = Home.GetAllItemNbr(categoryName, bookmark);

            if (bookmark != string.Empty)
            {
                lbl_bmk.FontWeight = FontWeights.Bold;
            }

            lbl_vltName.Content = VaultDatabase.GetVaultName();
            lbl_itemNbr.Content = allItermNbr + Data_Home.Default.ItemLegendNbr;

            // Ajoute des contrôles pour visualiser des catégries.
            Home.AddCategoryControls(stp_category, categoryName);

            if (allItermNbr == 0)
            {
                // Ajoute un contrôle lors du premier lancement de l'application.
                Label lbl_anyDataControl = Home.AddAnyDataControl();
                stp_allData.Children.Add(lbl_anyDataControl);
            }
            else
            {
                // Ajoute des contrôles pour visualiser des données.
                Home.AddACardsControls(stp_allData, categoryName, bookmark);
                Home.AddScrNoteDataControls(stp_allData, categoryName, bookmark);
            }
        }
        /// <summary>
        /// Action lors du clic sur le bouton "cmd_save".
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmd_save_Click(object sender, RoutedEventArgs e)
        {
            // Assigne à des propriétés, des entrées utilisateurs.
            RnmVault.SaveInputs(txt_name.Text);

            // Vérifie la longueur du nom du coffre-fort virtuel.
            if (RnmVault.IsVltNameLength_Error())
            {
                lbl_message.Content = Data_RnmVault.Default.IsVltNameLength_Error;
                return;
            }

            // Vérifie la mise à jour du nom du coffre-fort virtuel.
            if (VaultDatabase.UpdVaultName(txt_name.Text))
            {
                // Affiche l'interface d'accueil.
                usc_home usc_homeRename = new usc_home();
                Switcher.Switch(usc_homeRename);
                return;
            }
            else
            {
                System.Windows.Forms.MessageBox.Show(Data_VaultDatabase.Default.UpdVaultName);
                return;
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Initialise une nouvelle instance de la classe usc_scrNote.
        /// </summary>
        public usc_scrNote(List <string> _scrNoteData = null)
        {
            InitializeComponent();

            // Modifie la fenêtre principale et l'interface courante.
            Switcher.ChangeWindowTitle(Data_ScrNote.Default.ScrNoteTitle);
            cbo_category.ItemsSource = VaultDatabase.GetCategoryNameList();

            ScrNote.ScrNoteData = _scrNoteData;

            if (ScrNote.ScrNoteData == null)
            {
                ScrNote.UpdateDateAndCtgControls(lbl_crtDateValue, lbl_chgDateValue, cbo_category);
                return;
            }
            else
            {
                txt_name.Text              = ScrNote.ScrNoteData[0];
                txt_content.Text           = ScrNote.ScrNoteData[1];
                chk_bmk.IsChecked          = Convert.ToBoolean(ScrNote.ScrNoteData[2]);
                lbl_chgDateValue.Content   = ScrNote.ScrNoteData[3].Substring(0, 10);
                lbl_crtDateValue.Content   = ScrNote.ScrNoteData[4].Substring(0, 10);
                cbo_category.SelectedIndex = Convert.ToInt32(ScrNote.ScrNoteData[5]) - 1;
            }
        }
Esempio n. 8
0
 /// <summary>
 /// Met à jour des contrôles de l'interface de fiche d'authentification.
 /// </summary>
 /// <param name="_lbl_crtDate">Etiquette</param>
 /// <param name="_lbl_chgDate">Etiquette</param>
 /// <param name="_cbo_category">Liste déroulante</param>
 public static void UpdateDateAndCtgControls(Label _lbl_crtDate, Label _lbl_chgDate, ComboBox _cbo_category)
 {
     // Assigne les contrôles des dates courantes et des noms de catégories.
     _lbl_crtDate.Content        = DateTime.Now.Date.ToShortDateString();
     _lbl_chgDate.Content        = DateTime.Now.Date.ToShortDateString();
     _cbo_category.ItemsSource   = VaultDatabase.GetCategoryNameList();
     _cbo_category.SelectedIndex = 0;
 }
Esempio n. 9
0
        /// <summary>
        /// Vérifie la mise à jour des hachages des identifiants de connexion.
        /// </summary>
        /// <returns>Boolean : True -> Mise à jour effectuée. False -> Mise à jour non effectuée.</returns>
        public static bool IsUsnAndPwdUpdate()
        {
            bool successHashed = false;

            successHashed = VaultDatabase.UpdateUsnAndPwd(VaultDatabase.UserUsername, NewPwdInput_1);

            return(successHashed);
        }
Esempio n. 10
0
        /// <summary>
        /// Vérifie la correspondance des identifiants de connexion.
        /// </summary>
        /// <returns>Boolean : True -> Identifiants corrects. False -> Identifiants incorrect ou erreur.</returns>
        public static bool IsUsnAndPwdCheck()
        {
            bool hashAreEqual = false;

            hashAreEqual = VaultDatabase.CheckUsnAndPwd(VaultDatabase.UserUsername, OldPwdInput);

            return(hashAreEqual);
        }
Esempio n. 11
0
        /// <summary>
        /// Enregistre les identifiants de connexion.
        /// </summary>
        /// <returns>Boolean : True -> Identifiants de connexion enregistrés. False -> Identifiants de connexion non enregistrés.</returns>
        public static bool IsUsnAndPwdSave()
        {
            bool success = false;

            success = VaultDatabase.SaveUsnAndPwd(UsernameInput, PasswordInput_1);

            return(success);
        }
Esempio n. 12
0
        /// <summary>
        /// Vérifie la correspondance des identifiants de connexion.
        /// </summary>
        /// <returns>Boolean : True -> Identifiants corrects. False -> Identifiants incorrect ou erreur.</returns>
        public static bool IsUsnAndPwdCheck()
        {
            bool hashAreEqual = false;

            hashAreEqual = VaultDatabase.CheckUsnAndPwd(UsernameInput, PasswordInput_1);

            return(hashAreEqual);
        }
Esempio n. 13
0
        /// <summary>
        /// Vérifie l'existance du nom d'une fiche d'authentification
        /// </summary>
        /// <returns>Boolean : True -> Nom déjà existant. False -> Nom inexistant.</returns>
        public static bool IsAuthenCardExist()
        {
            bool isACardAlreadyExist = false;

            isACardAlreadyExist = VaultDatabase.CheckAuthenCard(ACardName);

            return(isACardAlreadyExist);
        }
Esempio n. 14
0
        /// <summary>
        /// Vérifie l'existance d'un nom de catégorie.
        /// </summary>
        /// <param name="_categoryName">Nom de la catégorie</param>
        /// <returns>Boolean : True -> Nom déjà existant. False -> Nom inexistant.</returns>
        public static bool IsCategoryExist()
        {
            bool isCategoryAlreadyExist = false;

            isCategoryAlreadyExist = VaultDatabase.CheckCategory(CategoryName);

            return(isCategoryAlreadyExist);
        }
Esempio n. 15
0
        /// <summary>
        /// Vérifie l'existance d'un nom d'une note sécurisée.
        /// </summary>
        /// <returns>Boolean : True -> Nom déjà existant. False -> Nom inexistant.</returns>
        public static bool IsScrNoteExist()
        {
            bool isScrNoteAlreadyExist = false;

            isScrNoteAlreadyExist = VaultDatabase.CheckScrNoteName(ScrNoteName);

            return(isScrNoteAlreadyExist);
        }
Esempio n. 16
0
        /// <summary>
        /// Action Lors du clic sur le bouton "cmd_connection".
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmd_save_Click(object sender, RoutedEventArgs e)
        {
            lbl_message.Content = string.Empty;

            // Assigne à des propriétés, des entrées utilisateurs.
            ScrNote.SaveInputs(txt_name.Text, txt_content.Text, cbo_category.SelectedItem.ToString(), Convert.ToBoolean(chk_bmk.IsChecked));

            // Vérifie les données de la note sécurisée.
            if (ScrNote.IsScrNoteDataEmpty())
            {
                lbl_message.Content = Data_ScrNote.Default.IsScrNoteDataEmpty;
                return;
            }

            // Assigne à une liste, des données à enregistrer.
            List <string> scrNoteData = ScrNote.GetScrNoteData();

            if (ScrNote.ScrNoteData != null)
            {
                // Assignement de données pour la modification d'une fiche d'authentification.
                scrNoteData.Add(ScrNote.ScrNoteData[6]);
                VaultDatabase.UpdateScrNoteData(scrNoteData);

                // Affiche l'interface d'accueil.
                usc_home usc_homeNote = new usc_home();
                Switcher.Switch(usc_homeNote);
                return;
            }

            // Vérifie l'existance du nom de la note sécurisée.
            if (ScrNote.IsScrNoteExist())
            {
                lbl_message.Content = Data_ScrNote.Default.IsScrNoteAlreadyExist;
                return;
            }

            // Vérifie le chiffrement des données de la note sécurisée.
            if (ScrNote.IsCipheredScrNoteDataEmpty(scrNoteData))
            {
                System.Windows.Forms.MessageBox.Show(Data_AES.Default.EncryptData);
                return;
            }

            // Vérifie l'enregistrement de la note sécurisée chiffrée.
            if (ScrNote.IsSaveScrNote(scrNoteData))
            {
                // Affiche l'interface d'accueil.
                usc_home usc_homeNote = new usc_home();
                Switcher.Switch(usc_homeNote);
                return;
            }
            else
            {
                System.Windows.Forms.MessageBox.Show(Data_VaultDatabase.Default.SaveScrNote);
                return;
            }
        }
Esempio n. 17
0
        /// <summary>
        /// Action lors du clic sur le bouton "cmd_aCardCopyUsn".
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void cmd_aCardCopyUsn_Click(object sender, RoutedEventArgs e)
        {
            Button        clickedButton    = sender as Button;
            string        authenCardID     = clickedButton.Name.Substring(13);
            List <byte[]> cipheredACardUsn = VaultDatabase.GetACardUsnList(authenCardID);
            List <string> plainACardUsn    = PlainData(cipheredACardUsn);

            // Enregistre le nom d'utilisateur dans le presse-papier.
            Clipboard.SetData(DataFormats.Text, (Object)plainACardUsn[0]);
            return;
        }
Esempio n. 18
0
        /// <summary>
        /// Vérifie l'existance d'une catégorie et l'enregistre.
        /// </summary>
        /// <param name="_categoryName">Nom d'une catégorie</param>
        private static void IsNotCategoryExist(string _categoryName)
        {
            string categoryName       = _categoryName;
            bool   isNotCategoryExist = (!VaultDatabase.CheckCategory(categoryName));

            // Vérifie l'existance du nom de catégorie.
            if (isNotCategoryExist)
            {
                // Enregistre un nom de catégorie.
                VaultDatabase.SaveCategory(categoryName);
            }
        }
Esempio n. 19
0
        /// <summary>
        /// Action lors du clic sur le bouton "cmd_save".
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmd_save_Click(object sender, RoutedEventArgs e)
        {
            // Assigne à des propriétés, des entrées utilisateurs.
            Category.SaveIputs(txt_name.Text);

            // Vérifie la longueur du nom de la catégorie.
            if (Category.IsCtgNameLength_Error())
            {
                lbl_message.Content = Data_Category.Default.IsCtgNameLength_Error;
                return;
            }

            // Vérifie l'existance du nom de catégorie.
            if (Category.IsCategoryExist())
            {
                lbl_message.Content = Data_Category.Default.IsCategoryExist;
                return;
            }

            // Vérifie le statut de l'action de modifier un nom de catégorie.
            if (Category.IsCategoryUpdate)
            {
                // Vérifie la mise à jour du nom de catégorie.
                if (VaultDatabase.UpdateCategory(OldCategoryName, txt_name.Text))
                {
                    // Affiche l'interface d'accueil.
                    usc_home usc_homeCategory = new usc_home();
                    Switcher.Switch(usc_homeCategory);
                    return;
                }
                else
                {
                    System.Windows.Forms.MessageBox.Show(Data_VaultDatabase.Default.UpdateCategory);
                    return;
                }
            }

            // Vérifie l'enregistrement du nom de catégorie.
            if (VaultDatabase.SaveCategory(txt_name.Text))
            {
                // Affiche l'interface d'accueil.
                usc_home usc_homeCategory = new usc_home();
                Switcher.Switch(usc_homeCategory);
                return;
            }
            else
            {
                System.Windows.Forms.MessageBox.Show(Data_VaultDatabase.Default.SaveCategory);
                return;
            }
        }
Esempio n. 20
0
        /// <summary>
        /// Vérifie l'existance d'un coffre-fort virtuel.
        /// </summary>
        /// <returns>Boolean : True -> Coffre-fort déjà existant. False -> Coffre-fort inexistant.</returns>
        public static bool IsFirstLaunch()
        {
            IsFirstRun = VaultDatabase.IsFirstLaunch();

            // Vérifie l'existance d'un coffre-fort virtuel.
            if (IsFirstRun)
            {
                // Vide les valeurs de salage.
                Data_Hash.Default.Reset();
                return(true);
            }

            return(false);
        }
Esempio n. 21
0
        /// <summary>
        /// Vérifie l'enregistrement des données.
        /// </summary>
        /// <param name="_scrNoteData">Liste des données à enregistrer.</param>
        /// <returns>Boolean : True -> Enregistrement effectué. False -> Enregistrement non effectué.</returns>
        public static bool IsSaveScrNote(List <string> _scrNoteData)
        {
            List <string> scrNoteData   = _scrNoteData;
            bool          isSaveScrNote = VaultDatabase.SaveScrNote(scrNoteData[0], scrNoteData[1], scrNoteData[2], scrNoteData[3], scrNoteData[3], scrNoteData[4]);

            // Vérifie l'enregistrement des données d'une note sécurisées.
            if (isSaveScrNote)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 22
0
        /// <summary>s
        /// Ajoute des contrôles pour visualiser des catégries.
        /// </summary>
        /// <param name="_stackPanel">Tableau de contrôles</param>
        public static void AddCategoryControls(StackPanel _stackPanel, string _categoryNameSelected)
        {
            string categoryNameSelected = _categoryNameSelected;

            // Assigne à une liste les noms ds catégories.
            List <string> categoriesName = VaultDatabase.GetCategoryNameList();

            // Vérifie le contenu de la liste des noms de catégories.
            if (categoriesName != null)
            {
                foreach (string element in categoriesName)
                {
                    // Assigne à une étiquette, des propriétés graphiques basiques.
                    Label lbl_categoryName = LabelBaseBuild(element, 300, 26);

                    // Vérifie et applique une propriété graphique à la catégorie sélectionné
                    if ((categoryNameSelected != string.Empty) && (element == categoryNameSelected))
                    {
                        lbl_categoryName.FontWeight = FontWeights.Bold;
                    }

                    _stackPanel.Children.Add(lbl_categoryName);

                    lbl_categoryName.MouseLeftButtonUp += new MouseButtonEventHandler(lbl_ctgName_MouseLeftButtonUp);

                    if (element != categoriesName[0])
                    {
                        lbl_categoryName.MouseRightButtonUp += new MouseButtonEventHandler(lbl_ctgName_MouseRightButtonUp);

                        // Assigne à une étiquette, un menu contextuel.
                        ContextMenu lbl_categoryNameContextMenu = new ContextMenu();
                        lbl_categoryName.ContextMenu = lbl_categoryNameContextMenu;

                        // Assigne à un menu contextuel, un menu d'élément.
                        MenuItem lbl_MenuItemRename = new MenuItem();
                        lbl_MenuItemRename.Header = Data_Home.Default.AddCategoryControls_Rename + lbl_categoryName.Content.ToString();
                        lbl_MenuItemRename.Click += new RoutedEventHandler(lbl_MenuItemRename_Click);
                        lbl_categoryNameContextMenu.Items.Add(lbl_MenuItemRename);

                        // Assigne à un menu contextuel, un menu d'élément.
                        MenuItem lbl_MenuItemDelete = new MenuItem();
                        lbl_MenuItemDelete.Header = Data_Home.Default.AddCategoryControls_Delete + lbl_categoryName.Content.ToString();
                        lbl_MenuItemDelete.Click += new RoutedEventHandler(lbl_MenuItemDelete_Click);
                        lbl_categoryNameContextMenu.Items.Add(lbl_MenuItemDelete);
                    }
                }
            }
        }
Esempio n. 23
0
        /// <summary>
        /// Obtient le nombre total d'éléments.
        /// </summary>
        /// <returns>Int : Réussite -> Nombre total d'éléments. Echec -> Valeur -2.</returns>
        public static int GetAllItemNbr(string _categoryName = "", string _bookmark = "")
        {
            string categoryName = _categoryName;
            string bookmark     = _bookmark;

            // Assigne à un nombre le nombre de fiche d'authentification.
            int authenCardNbr = VaultDatabase.GetACardNumber(categoryName, bookmark);

            // Assigne à un nombre le nombre de note sécurisée.
            int scrNoteNbr = VaultDatabase.GetScrNoteNumber(categoryName, bookmark);

            // Assigne à un nombre le total des deux nombres.
            int allItemNbr = authenCardNbr + scrNoteNbr;

            return(allItemNbr);
        }
Esempio n. 24
0
        /// <summary>
        /// Vérifie l'enregistrement des données d'une fiche d'authentification.
        /// </summary>
        /// <param name="_aCardData">Liste des données à enregistrer.</param>
        /// <returns>Boolean : True -> Enregistrement effectué. False -> Enregistrement non effectué.</returns>
        public static bool IsSaveAuthenCard(List <string> _aCardData)
        {
            List <string> aCardData           = _aCardData;
            bool          isSaveAthenCardData = VaultDatabase.SaveAuthenCard(aCardData[0], aCardData[1], aCardData[2], aCardData[3], aCardData[4],
                                                                             aCardData[5], aCardData[6], aCardData[7], aCardData[7], aCardData[8]);

            // Vérifie l'enregistrement des données d'une fiche d'authentification.
            if (isSaveAthenCardData)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 25
0
        public void ReadVault()
        {
            string vaultPath = GetVaultPath();

            OutLineFormat("Loading vaults from {0}", ConsoleColor.Cyan, vaultPath);
            VaultDatabase vaultDatabase = VaultDatabase.FromFile(vaultPath);

            foreach (Vault toRead in Vault.LoadAll(vaultDatabase))
            {
                OutLineFormat("Vault {0}", ConsoleColor.DarkBlue, toRead.Name);
                foreach (string key in toRead.Keys)
                {
                    OutLineFormat("{0}: {1}", key, toRead[key]);
                }
                OutLine();
            }
        }
Esempio n. 26
0
        /// <summary>
        /// Action lors du clic sur le label "lbl_aCardUpdate".
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void lbl_aCardUpdate_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            // Assigne les données d'une fiche d'authentification pour la modifier.
            Label  clickedLabel = sender as Label;
            string authenCardID = clickedLabel.Name.Substring(13);

            List <string> authenCardName = VaultDatabase.GetACardNameList(authenCardID);
            List <string> authenCardShc  = VaultDatabase.GetACardShcList(authenCardID);

            List <byte[]> authenCardCipheredUsn = VaultDatabase.GetACardUsnList(authenCardID);
            List <string> authenCardPlainUsn    = PlainData(authenCardCipheredUsn);

            List <byte[]> authenCardCipheredPwd = VaultDatabase.GetACardPwdList(authenCardID);
            List <string> authenCardPlainPwd    = PlainData(authenCardCipheredPwd);

            List <byte[]> authenCardCipheredScrNote = VaultDatabase.GetACardScrNoteList(authenCardID);
            List <string> authenCardPlainScrNote    = PlainData(authenCardCipheredScrNote);

            bool          authenCardBookmark = VaultDatabase.GetACardBookmark(authenCardID);
            List <string> authenCardCrtDate  = VaultDatabase.GetACardCrtDate(authenCardID);
            List <string> authenCardChgDate  = VaultDatabase.GetACardChgDate(authenCardID);
            List <string> authenCardCategory = VaultDatabase.GetACardCategory(authenCardID);

            List <string> authenCardData = new List <string>();

            authenCardData.Add(authenCardName[0]);
            authenCardData.Add(authenCardShc[0]);
            authenCardData.Add(authenCardPlainUsn[0]);
            authenCardData.Add(authenCardPlainPwd[0]);
            authenCardData.Add(authenCardPlainScrNote[0]);
            authenCardData.Add(authenCardBookmark.ToString());
            authenCardData.Add(authenCardCrtDate[0]);
            authenCardData.Add(authenCardChgDate[0]);
            authenCardData.Add(authenCardCategory[0]);
            authenCardData.Add(authenCardID);

            usc_authenCard usc_authenCardHome = new usc_authenCard(authenCardData);

            Switcher.Switch(usc_authenCardHome);

            return;
        }
Esempio n. 27
0
        private static Vault GetTestCredentialVault(out VaultDatabase db)
        {
            string filePath = Path.Combine(Paths.Data, "TestVaults.vault.sqlite");

            return(Vault.Load(new FileInfo(filePath), 8.RandomLetters(), out db));
        }
Esempio n. 28
0
        /// <summary>
        /// Ajoute des contrôles pour visualiser des notes sécurisées.
        /// </summary>
        /// <param name="_stackPanel">Tableau de contrôles</param>
        /// <param name="_category">Nom de catégorie pour le tri</param>
        /// <param name="_bookmark">Satut dees favoris pour le tri</param>
        public static void AddScrNoteDataControls(StackPanel _stackPanel, string _category = "", string _bookmark = "")
        {
            string category = _category;
            string bookmark = _bookmark;

            // Assigne à des listes, les données des notes sécurisées.
            List <string> scrNoteID                 = VaultDatabase.GetScrNoteIDList(_categoryName: category, _bookmark: bookmark);
            List <string> scrNoteNameList           = VaultDatabase.GetScrNoteNameList(_categoryName: category, _bookmark: bookmark);
            List <byte[]> scrNoteCipheredContenList = VaultDatabase.GetScrNoteContentList(_categoryName: category, _bookmark: bookmark);

            if ((scrNoteNameList != null) || (scrNoteCipheredContenList != null))
            {
                // Assigne à des listes, les données des notes sécurisées.
                List <string> scrNotePlainContentList = PlainData(scrNoteCipheredContenList);

                // Assigne à une étiquette, un nom de section des données.
                Label lbl_dataSection = LabelDataSection(Data_Home.Default.lbl_scrNoteSection_Content);
                _stackPanel.Children.Add(lbl_dataSection);

                for (int index = 0; index < scrNoteNameList.Count; index++)
                {
                    // Assigne à un tableau de contrôles, les données de chaque note sécurisée.
                    StackPanel stp_scrNoteData = StackPanelBaseBuild(910, 136, 20);
                    _stackPanel.Children.Add(stp_scrNoteData);

                    // Assigne à un tableau de contrôles, le nom et les actions d'une note sécurisée.
                    StackPanel stp_scrNoteFirstLine = StackPanelBaseBuild(910, 26, 0);
                    stp_scrNoteFirstLine.Orientation = Orientation.Horizontal;
                    stp_scrNoteData.Children.Add(stp_scrNoteFirstLine);

                    // Assigne à une étiquette, le nom d'une note sécurisée.
                    Label lbl_scrNoteName = LabelBaseBuild(scrNoteNameList[index], 280, 26);
                    stp_scrNoteFirstLine.Children.Add(lbl_scrNoteName);

                    // Assigne à une étiquette, l'action de modifier une note sécurisée.
                    Label lbl_scrNoteUpdate = LabelScrNoteActions(Data_Home.Default.lbl_mainDataUpdate);
                    lbl_scrNoteUpdate.Margin = new Thickness(440, 0, 0, 0);

                    lbl_scrNoteUpdate.Name = Data_Home.Default.scrNoteID + scrNoteID[index];
                    lbl_scrNoteUpdate.MouseLeftButtonUp += new MouseButtonEventHandler(lbl_scrNoteUpdate_MouseLeftButtonUp);
                    stp_scrNoteFirstLine.Children.Add(lbl_scrNoteUpdate);

                    // Assigne à une étiquette, l'action de supprimer une note sécurisée.
                    Label lbl_scrNoteDelete = LabelScrNoteActions(Data_Home.Default.lbl_mainDataDelete);
                    lbl_scrNoteDelete.Margin = new Thickness(10, 0, 0, 0);

                    lbl_scrNoteDelete.Name = Data_Home.Default.scrNoteID + scrNoteID[index];
                    lbl_scrNoteDelete.MouseLeftButtonUp += new MouseButtonEventHandler(lbl_scrNoteDelete_MouseLeftButtonUp);
                    stp_scrNoteFirstLine.Children.Add(lbl_scrNoteDelete);

                    // Assigne à un tableau de contrôles, le contenu d'une note sécurisée.
                    StackPanel stp_scrNoteSecondLine = StackPanelBaseBuild(910, 100, 10);
                    stp_scrNoteData.Children.Add(stp_scrNoteSecondLine);

                    // Assigne à un champs de saisie, le contenu d'ne note sécurisée.
                    TextBox txt_scrNoteContent = TextBoxScrNoteContent(scrNotePlainContentList[index]);
                    txt_scrNoteContent.Margin = new Thickness(260, 0, 0, 0);
                    stp_scrNoteSecondLine.Children.Add(txt_scrNoteContent);
                }
            }
        }
Esempio n. 29
0
        /// <summary>
        /// Ajoute des contrôles pour visualiser des fiches d'authentification.
        /// </summary>
        /// <param name="_stackPanel">Tableau de contrôles</param>
        /// <param name="_category">Nom de catégorie pour le tri</param>
        /// <param name="_bookmark">Satut dees favoris pour le tri</param>
        public static void AddACardsControls(StackPanel _stackPanel, string _category = "", string _bookmark = "")
        {
            string category     = _category;
            string bookmark     = _bookmark;
            string contentLabel = string.Empty;

            // Assigne à des listes, les données des fiches d'authentification.
            List <string> aCardsIDList          = VaultDatabase.GetACardIDList(_categoryName: category, _bookmark: bookmark);
            List <string> aCardsNameList        = VaultDatabase.GetACardNameList(_categoryName: category, _bookmark: bookmark);
            List <string> aCardsShcList         = VaultDatabase.GetACardShcList(_categoryName: category, _bookmark: bookmark);
            List <byte[]> aCardsCipheredUsnList = VaultDatabase.GetACardUsnList(_categoryName: category, _bookmark: bookmark);
            List <string> aCardsCpxList         = VaultDatabase.GetACardCpxFactorList(_categoryName: category, _bookmark: bookmark);

            if ((aCardsNameList != null) || (aCardsShcList != null) || (aCardsCipheredUsnList != null) || (aCardsCpxList != null))
            {
                // Assigne à des listes, les données des fiches d'authentification.
                List <string> aCardPlainUsnList = PlainData(aCardsCipheredUsnList);

                // Assigne à une étiquette, un nom de section des données.
                Label lbl_dataSection = LabelDataSection(Data_Home.Default.lbl_aCardSection_Content);
                _stackPanel.Children.Add(lbl_dataSection);

                for (int index = 0; index < aCardsNameList.Count; index++)
                {
                    // Assigne à un tableau de contrôles, les données de chaque fiche d'authentification.
                    StackPanel stp_AuthenCardData = new StackPanel();
                    stp_AuthenCardData.Width  = 910;
                    stp_AuthenCardData.Height = 72;
                    _stackPanel.Children.Add(stp_AuthenCardData);

                    // Assigne à un tableau de contrôles, le nom et les actions d'une fiche d'authentification.
                    StackPanel stp_aCardFirstLine = new StackPanel();
                    stp_aCardFirstLine.Height      = 36;
                    stp_aCardFirstLine.Orientation = Orientation.Horizontal;
                    stp_AuthenCardData.Children.Add(stp_aCardFirstLine);

                    // Assigne à une étiquette, le nom d'une fiche d'authentification.
                    Label lbl_authenCardName = LabelBaseBuild(aCardsNameList[index], 270, 26);
                    stp_aCardFirstLine.Children.Add(lbl_authenCardName);

                    // Assigne à une étiquette, le raccourci d'une fiche d'authentification.
                    Label lbl_authenCardShc = LabelBaseBuild(aCardsShcList[index], 170, 26);
                    lbl_authenCardShc.Margin             = new Thickness(10, 0, 0, 0);
                    lbl_authenCardShc.Foreground         = new SolidColorBrush(Colors.Blue);
                    lbl_authenCardShc.MouseLeftButtonUp += new MouseButtonEventHandler(lbl_authenCardShc_MouseLeftButtonUp);
                    stp_aCardFirstLine.Children.Add(lbl_authenCardShc);

                    // Assigne à une étiquette, le nom d'utilisateur d'une fiche d'authentification.
                    Label lbl_authenCardUsn = LabelBaseBuild(aCardPlainUsnList[index], 190, 26);
                    lbl_authenCardUsn.Margin = new Thickness(10, 0, 0, 0);
                    stp_aCardFirstLine.Children.Add(lbl_authenCardUsn);

                    // Assigne à une étiquette, le facteur de complexité d'une fiche d'authentification.
                    contentLabel = aCardsCpxList[index] + Data_Home.Default.lbl_aCardCpxFactor_Content;
                    Label lbl_aCardCpxFactor = LabelBaseBuild(contentLabel, 90, 26);
                    lbl_aCardCpxFactor.Margin = new Thickness(10, 0, 0, 0);
                    ChangeLabelColor(aCardsCpxList[index], lbl_aCardCpxFactor);
                    stp_aCardFirstLine.Children.Add(lbl_aCardCpxFactor);

                    // Assigne à une étiquette, l'action de modifier une fiche d'authentification.
                    Label lbl_aCardUpdate = LabelBaseBuild(Data_Home.Default.lbl_mainDataUpdate, 60, 26);
                    lbl_aCardUpdate.Margin = new Thickness(10, 0, 0, 0);

                    lbl_aCardUpdate.Name = Data_Home.Default.authenCardID + aCardsIDList[index];
                    lbl_aCardUpdate.MouseLeftButtonUp += new MouseButtonEventHandler(lbl_aCardUpdate_MouseLeftButtonUp);
                    stp_aCardFirstLine.Children.Add(lbl_aCardUpdate);

                    // Assigne à une étiquette, l'action de supprimer une fiche d'authentification.
                    Label lbl_aCardDelete = LabelBaseBuild(Data_Home.Default.lbl_mainDataDelete, 70, 26);
                    lbl_aCardDelete.Margin = new Thickness(10, 0, 0, 0);

                    lbl_aCardDelete.Name = Data_Home.Default.authenCardID + aCardsIDList[index];
                    lbl_aCardDelete.MouseLeftButtonUp += new MouseButtonEventHandler(lbl_aCardDelete_MouseLeftButtonUp);
                    stp_aCardFirstLine.Children.Add(lbl_aCardDelete);

                    // Assigne à un tableau de contrôles, les actions de copies d'une fiche d'authentification.
                    StackPanel stp_aCardSecondLine = new StackPanel();
                    stp_aCardSecondLine.Height      = 36;
                    stp_aCardSecondLine.Orientation = Orientation.Horizontal;
                    stp_AuthenCardData.Children.Add(stp_aCardSecondLine);

                    // Assigne à un bouton, l'action de copier le nom d'utilisateur d'une fiche d'authentification.
                    Button cmd_aCardCopyUsn = ButtonACardCopy(Data_Home.Default.cmd_aCardCopyUsn);
                    cmd_aCardCopyUsn.Margin = new Thickness(590, 0, 0, 0);

                    cmd_aCardCopyUsn.Name   = Data_Home.Default.authenCardID + aCardsIDList[index];
                    cmd_aCardCopyUsn.Click += new RoutedEventHandler(cmd_aCardCopyUsn_Click);
                    stp_aCardSecondLine.Children.Add(cmd_aCardCopyUsn);

                    // Assigne à un bouton, l'action de copier le mot de passe d'une fiche d'authentification.
                    Button cmd_aCardCopyPwd = ButtonACardCopy(Data_Home.Default.cmd_aCardCopyPwd);
                    cmd_aCardCopyPwd.Margin = new Thickness(10, 0, 0, 0);

                    cmd_aCardCopyPwd.Name   = Data_Home.Default.authenCardID + aCardsIDList[index];
                    cmd_aCardCopyPwd.Click += new RoutedEventHandler(cmd_aCardCopyPwd_Click);
                    stp_aCardSecondLine.Children.Add(cmd_aCardCopyPwd);
                }
            }
        }
Esempio n. 30
0
        /// <summary>
        /// Action lors du clic sur le bouton "cmd_save".
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmd_save_Click(object sender, RoutedEventArgs e)
        {
            string cpxFactor        = lbl_cpxFactor.Content.ToString();
            string selectedCategory = cbo_category.SelectedItem.ToString();
            bool   bookmarkSatut    = Convert.ToBoolean(chk_bmk.IsChecked);

            lbl_message.Content = string.Empty;

            // Assigne à des propriétés, des entrées utilisateurs.
            AuthenCard.SaveIputs(txt_name.Text, txt_shortcut.Text, txt_username.Text, txt_password.Text, cpxFactor, txt_scrNote.Text, selectedCategory, bookmarkSatut);

            // Vérifie les données de la fiche d'authentification.
            if (AuthenCard.IsAuthenCardDataEmpty())
            {
                lbl_message.Content = Data_AuthenCard.Default.IsACardDataNull;
                return;
            }

            // Assigne à une liste des données à enregistrer.
            List <string> aCardData = AuthenCard.GetAuthenCardData();

            // Vérifie le contenu d'une propriété pour la modification.
            if (AuthenCard.ACardData != null)
            {
                // Assignement de données pour la modification d'une fiche d'authentification.
                aCardData.Add(AuthenCard.ACardData[9]);
                VaultDatabase.UpdateAuthenCardData(aCardData);

                // Affiche l'interface d'accueil.
                usc_home usc_homeAuthenCard = new usc_home();
                Switcher.Switch(usc_homeAuthenCard);
                return;
            }

            // Vérifie l'existance du nom de la fiche d'authentification.
            if (AuthenCard.IsAuthenCardExist())
            {
                lbl_message.Content = Data_AuthenCard.Default.IsAuthenCardExist;
                return;
            }

            // Vérifie le chiffrement des données de la fiche d'authentification.
            if (AuthenCard.IsCipheredACardDataEmpty(aCardData))
            {
                System.Windows.Forms.MessageBox.Show(Data_AES.Default.EncryptData);
                return;
            }

            // Vérifie l'enregistrement de la fiche d'authentification chiffrée.
            if (AuthenCard.IsSaveAuthenCard(aCardData))
            {
                // Affiche l'interface d'accueil.
                usc_home usc_homeNote = new usc_home();
                Switcher.Switch(usc_homeNote);
                return;
            }
            else
            {
                System.Windows.Forms.MessageBox.Show(Data_VaultDatabase.Default.SaveAuthenCard);
                return;
            }
        }