mirror of
https://github.com/Crypto-Notepad/Crypto-Notepad.git
synced 2026-03-11 08:55:25 +00:00
Fixed performance issues on large values of Password iterations when "Save As" #43
This commit is contained in:
parent
dfe7e152f6
commit
b808026465
1 changed files with 12 additions and 3 deletions
|
|
@ -1174,13 +1174,22 @@ private async void SaveAsMainMenu_Click(object sender, EventArgs e)
|
||||||
TypedPassword.Value = PublicVar.encryptionKey.Get();
|
TypedPassword.Value = PublicVar.encryptionKey.Get();
|
||||||
}
|
}
|
||||||
filePath = saveFileDialog.FileName;
|
filePath = saveFileDialog.FileName;
|
||||||
string enc = await AES.Encrypt(richTextBox.Text, TypedPassword.Value, null, settings.HashAlgorithm,
|
mainMenu.Enabled = false;
|
||||||
Convert.ToInt32(settings.PasswordIterations), Convert.ToInt32(settings.KeySize));
|
toolbarPanel.Enabled = false;
|
||||||
|
richTextBox.ReadOnly = true;
|
||||||
|
richTextBox.SuspendDrawing();
|
||||||
|
UseWaitCursor = true;
|
||||||
using (StreamWriter writer = new StreamWriter(filePath))
|
using (StreamWriter writer = new StreamWriter(filePath))
|
||||||
{
|
{
|
||||||
writer.Write(enc);
|
writer.Write(await AES.Encrypt(richTextBox.Text, PublicVar.encryptionKey.Get(), null, settings.HashAlgorithm,
|
||||||
|
Convert.ToInt32(settings.PasswordIterations), Convert.ToInt32(settings.KeySize)));
|
||||||
writer.Close();
|
writer.Close();
|
||||||
}
|
}
|
||||||
|
richTextBox.ResumeDrawing();
|
||||||
|
UseWaitCursor = false;
|
||||||
|
mainMenu.Enabled = true;
|
||||||
|
toolbarPanel.Enabled = true;
|
||||||
|
richTextBox.ReadOnly = false;
|
||||||
richTextBox.Modified = false;
|
richTextBox.Modified = false;
|
||||||
Text = PublicVar.appName + " – " + Path.GetFileName(filePath);
|
Text = PublicVar.appName + " – " + Path.GetFileName(filePath);
|
||||||
PublicVar.encryptionKey.Set(TypedPassword.Value);
|
PublicVar.encryptionKey.Set(TypedPassword.Value);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue