Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Critical bug after file saving #14

Closed
Sigmanor opened this issue Dec 19, 2018 · 1 comment
Closed

[BUG] Critical bug after file saving #14

Sigmanor opened this issue Dec 19, 2018 · 1 comment
Assignees
Labels
bug Indicates an unexpected problem or unintended behavior help wanted Indicates that a maintainer wants help on an issue or pull request hotfix Indicates an unexpected problem or unintended behavior that must be fixed ASAP
Milestone

Comments

@Sigmanor
Copy link
Member

Sigmanor commented Dec 19, 2018

Sometimes after saving the file, there is no possibility to open it anymore, the password is incorrect.
This bug only appears in 1.1.3+ versions.

@h5p9sl can you help me to fix this? Because on version 1.1.2 I can't reproduce this bug, so it's appeared after the last updates, and I have not changed anything in the encryption code in recent updates. So I need your help.

To catch this bug I wrote a small code. This code is try to encrypt the opened file, and then decrypt it.

Loop that saving the file for a 10 times

            int i = 1;
            while (i != 10)
            {
                i++;
                Text = i.ToString();
                saveToolStripMenuItem1_Click_1(sender, e);
                CheckFileSavedCorrectly();
            }

This code is for open the file after saving

private void CheckFileSavedCorrectly()
        {
            string de = "";
            try
            {
                string opnfile = File.ReadAllText(OpenFile.FileName);
                de = AES.Decrypt(opnfile, PublicVar.encryptionKey.Get(), null, ps.HashAlgorithm, ps.PasswordIterations, ps.KeySize);
                customRTB.Text = de;
                string cc2 = customRTB.Text.Length.ToString(CultureInfo.InvariantCulture);
                customRTB.Select(Convert.ToInt32(cc2), 0);
            }
            catch (CryptographicException)
            {
                MessageBox.Show("Gotcha!");
            }

        }

How it works

2018-12-19_01-59-09

@Sigmanor Sigmanor added bug Indicates an unexpected problem or unintended behavior hotfix Indicates an unexpected problem or unintended behavior that must be fixed ASAP labels Dec 19, 2018
@Sigmanor Sigmanor added this to the v1.3.0 milestone Dec 19, 2018
@Sigmanor Sigmanor self-assigned this Dec 19, 2018
@Sigmanor Sigmanor added help wanted Indicates that a maintainer wants help on an issue or pull request in progress labels Dec 19, 2018
@Sigmanor
Copy link
Member Author

Fixed in #15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior help wanted Indicates that a maintainer wants help on an issue or pull request hotfix Indicates an unexpected problem or unintended behavior that must be fixed ASAP
Projects
Status: ✅ Done
Development

No branches or pull requests

1 participant