/// <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;
        }
Esempio n. 2
0
 private void Confirm_Click(object sender, EventArgs e)
 {
     if (KeyfileLocation.TextLength > 0)
     {
         if (!Crypto.DecryptFile(FileOP.GetFile(), FileOP.KeyFileToBits(KeyfileLocation.Text)))
         {
             MessageBox.Show("Inncorrect Credentials. Please Try Again.", "Access Denied", MessageBoxButtons.OK);
             KeyfileLocation.ResetText();
         }
         else if (!Crypto.DecryptFile(FileOP.GetFile(), passwordEntry.Text))
         {
             Crypto.EncryptFile(FileOP.GetFile(), FileOP.KeyFileToBits(KeyfileLocation.Text));
             MessageBox.Show("Inncorrect Credentials. Please Try Again.", "Access Denied", MessageBoxButtons.OK);
             KeyfileLocation.ResetText();
         }
         else
         {
             FileOP.LoadKeyFile(KeyfileLocation.Text);
             Crypto.mPassTemp = passwordEntry.Text;
             Compressor.Decompress(FileOP.GetFile());
             TheParent.PerformRefresh(true);
             success = true;
             this.Close();
         }
     }
     else if (!Crypto.DecryptFile(FileOP.GetFile(), passwordEntry.Text))
     {
         MessageBox.Show("Inncorrect Credentials. Please Try Again.", "Access Denied", MessageBoxButtons.OK);
         KeyfileLocation.ResetText();
     }
     else
     {
         Crypto.mPassTemp = passwordEntry.Text;
         Compressor.Decompress(FileOP.GetFile());
         TheParent.PerformRefresh(true);
         success = true;
         this.Close();
     }
 }