Пример #1
0
        private static void CreateSaltFile(string directoryPath, byte[] salt)
        {
            string saltFilePath = Path.Combine(directoryPath, Constants.SaltFile);

            File.WriteAllBytes(saltFilePath, salt);
            FileHandling.MakeFileReadOnly(saltFilePath);
        }
Пример #2
0
 private static void Finalize(string inputFilePath, string outputFilePath)
 {
     if (Globals.Overwrite)
     {
         FileHandling.OverwriteFile(inputFilePath, outputFilePath);
     }
     else if (Globals.ObfuscateFileNames)
     {
         RestoreFileName.RemoveAppendedFileName(inputFilePath);
     }
     FileHandling.MakeFileReadOnly(outputFilePath);
 }
Пример #3
0
        private static void CompleteEncryption(string filePath, string encryptedFilePath, byte[] macKey)
        {
            // Calculate and append MAC
            bool fileSigned = FileAuthentication.SignFile(encryptedFilePath, macKey);

            Utilities.ZeroArray(macKey);
            if (fileSigned == true && Globals.OverwriteFiles == true)
            {
                FileHandling.OverwriteFile(filePath, encryptedFilePath);
            }
            FileHandling.MakeFileReadOnly(encryptedFilePath);
            GetEncryptionResult(filePath, fileSigned);
        }