Пример #1
0
 public static void DecryptEachFileWithPassword(string[] filePaths, byte[] passwordBytes)
 {
     Globals.TotalCount = filePaths.Length;
     foreach (string inputFilePath in filePaths)
     {
         bool validFilePath = FilePathValidation.FileDecryption(inputFilePath);
         if (!validFilePath)
         {
             --Globals.TotalCount;
             continue;
         }
         UsingPassword(inputFilePath, passwordBytes);
     }
     Utilities.ZeroArray(passwordBytes);
     DisplayMessage.SuccessfullyDecrypted();
 }
Пример #2
0
 public static void DecryptEachFileWithPrivateKey(string[] filePaths, byte[] privateKey)
 {
     Globals.TotalCount = filePaths.Length;
     privateKey         = PrivateKey.Decrypt(privateKey);
     if (privateKey == null)
     {
         return;
     }
     foreach (string inputFilePath in filePaths)
     {
         bool validFilePath = FilePathValidation.FileDecryption(inputFilePath);
         if (!validFilePath)
         {
             --Globals.TotalCount;
             continue;
         }
         UsingPrivateKey(inputFilePath, privateKey);
     }
     Utilities.ZeroArray(privateKey);
     DisplayMessage.SuccessfullyDecrypted();
 }
Пример #3
0
 public static void DecryptEachFileWithPrivateKey(string[] filePaths, byte[] recipientPrivateKey, byte[] senderPublicKey)
 {
     Globals.TotalCount  = filePaths.Length;
     recipientPrivateKey = PrivateKey.Decrypt(recipientPrivateKey);
     if (recipientPrivateKey == null)
     {
         return;
     }
     byte[] sharedSecret = KeyExchange.GetSharedSecret(recipientPrivateKey, senderPublicKey);
     Utilities.ZeroArray(recipientPrivateKey);
     foreach (string inputFilePath in filePaths)
     {
         bool validFilePath = FilePathValidation.FileDecryption(inputFilePath);
         if (!validFilePath)
         {
             --Globals.TotalCount;
             continue;
         }
         UsingPrivateKey(inputFilePath, sharedSecret, recipientPrivateKey);
     }
     Utilities.ZeroArray(sharedSecret);
     DisplayMessage.SuccessfullyDecrypted();
 }