Пример #1
0
 private void OkButton_Click(object sender, EventArgs e)
 {
     if ((PassEntry1.Text == PassEntry2.Text) && String.IsNullOrEmpty(PassEntry1.Text) == false && String.IsNullOrEmpty(PassEntry2.Text) == false)
     {
         if (KeyFileCheckBox.Checked)
         {
             if (FileOP.GetKeyFile() != "" && FileOP.GetKeyFile() != null && File.Exists(FileOP.GetKeyFile()))
             {
                 KeyFileLocationText.Text = FileOP.GetKeyFile();
                 Crypto.mPassTemp         = PassEntry1.Text;
                 CreatePrintPopUp();
             }
             else
             {
                 MessageBox.Show("Your key file is invalid. Please reselect your keyfile.", "File Error", MessageBoxButtons.OK);
             }
         }
         else
         {
             Crypto.mPassTemp = PassEntry1.Text;
             CreatePrintPopUp();
         }
     }
     else
     {
         string            message = "Your passwords do not match or the boxes are blank. Please try entering them again";
         string            title   = "Pass Keeper";
         MessageBoxButtons buttons = MessageBoxButtons.OK;
         _ = MessageBox.Show(message, title, buttons);
     }
 }
Пример #2
0
 private void FindKeyFile_Click(object sender, EventArgs e)
 {
     if (FileOP.SelectKeyFile())
     {
         KeyfileLocation.Text = FileOP.GetKeyFile();
     }
 }
        private void button1_Click(object sender, EventArgs e)
        {
            FileOP.SelectKeyFile();
            Crypto.EncryptFile(FileOP.GetFile(), FileOP.KeyFileToBits(FileOP.GetKeyFile()));
            FileOP.ClearKeyFile();
            MasterForm frm = new MasterForm();

            frm.Show();
            frm.PerformRefresh();
            this.Close();
        }
Пример #4
0
        /// <summary>
        /// Unlocks the current file
        /// </summary>
        private void UnlockFile()
        {
            if (FileOP.GetKeyFile().Length > 0)
            {
                Crypto.DecryptFile(FileOP.GetFile(), FileOP.KeyFileToBits(FileOP.GetKeyFile()));
                CryptoProgBar.Value = 16;
            }

            Crypto.DecryptFile(FileOP.GetFile(), Crypto.mPassTemp);
            CryptoProgBar.Value = 33;

            Compressor.Decompress(FileOP.GetFile());
            CryptoProgBar.Value = 50;
        }
Пример #5
0
 /// <summary>
 /// Locks the file when called
 /// </summary>
 private void LockFile()
 {
     //Compresses File
     Compressor.Compress(FileOP.GetFile());
     CryptoProgBar.Value = 66;
     //Encrypt the file with stored password
     Crypto.EncryptFile(FileOP.GetFile(), Crypto.mPassTemp);
     CryptoProgBar.Value = 83;
     //If a Keyfile was used to open the file, use it to encrypt the file when locking
     if (FileOP.GetKeyFile().Length > 0)
     {
         //Encrypt the file with the KeyFile
         Crypto.EncryptFile(FileOP.GetFile(), FileOP.KeyFileToBits(FileOP.GetKeyFile()));
         CryptoProgBar.Value = 100;
     }
     CryptoProgBar.Value = 0;
 }
        private void OkButton_Click(object sender, EventArgs e)
        {
            if ((PassEntry1.Text == PassEntry2.Text) && String.IsNullOrEmpty(PassEntry1.Text) == false && String.IsNullOrEmpty(PassEntry2.Text) == false)
            {
                if (KeyFileCheckBox.Checked)
                {
                    if (FileOP.GetKeyFile() != "" && FileOP.GetKeyFile() != null && File.Exists(FileOP.GetKeyFile()))
                    {
                        Compressor.Compress(FileOP.GetFile());
                        Crypto.EncryptFile(FileOP.GetFile(), PassEntry1.Text);
                        Crypto.EncryptFile(FileOP.GetFile(), FileOP.KeyFileToBits(FileOP.GetKeyFile()));
                        KeyFileLocationText.Text = FileOP.GetKeyFile();
                        FileOP.ClearKeyFile();

                        MasterPasswordPrintPopUp printPopUp = new MasterPasswordPrintPopUp(PassEntry1.Text);
                        printPopUp.ShowDialog();
                        FileOP.ClearFile();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Your key file is invalid. Please reselect your keyfile.", "File Error", MessageBoxButtons.OK);
                    }
                }
                else
                {
                    Compressor.Compress(FileOP.GetFile());
                    Crypto.EncryptFile(FileOP.GetFile(), PassEntry1.Text);

                    MasterPasswordPrintPopUp printPopUp = new MasterPasswordPrintPopUp(PassEntry1.Text);
                    printPopUp.ShowDialog();
                    FileOP.ClearFile();
                    this.Close();
                }
            }
            else
            {
                string            message = "Your passwords do not match or the boxes are blank. Please try entering them again";
                string            title   = "Pass Keeper";
                MessageBoxButtons buttons = MessageBoxButtons.OK;
                _ = MessageBox.Show(message, title, buttons);
            }
        }
Пример #7
0
 private void FindKeyFile_Click(object sender, EventArgs e)
 {
     FileOP.SelectKeyFile();
     KeyFileLocationText.Text = FileOP.GetKeyFile();
 }