Example #1
0
        private static void CheckForTampering(string filePath, int parametersLength, byte[] encryptionKey, byte[] macKey, BackgroundWorker bgwDecryption)
        {
            bool fileTampered = FileAuthentication.AuthenticateFile(filePath, macKey, out byte[] macBackup);

            Utilities.ZeroArray(macKey);
            if (fileTampered == false)
            {
                DecryptFile(filePath, parametersLength, macBackup, encryptionKey, bgwDecryption);
            }
            else
            {
                Globals.ResultsText += $"{Path.GetFileName(filePath)}: Incorrect password/keyfile or this file has been tampered with.{Environment.NewLine}";
                Utilities.ZeroArray(encryptionKey);
            }
        }