Exemple #1
0
 public static void EncryptEachFileWithPassword(string[] filePaths, byte[] passwordBytes)
 {
     Globals.TotalCount = filePaths.Length;
     foreach (string inputFilePath in filePaths)
     {
         bool validFilePath = FilePathValidation.FileEncryption(inputFilePath);
         if (!validFilePath)
         {
             --Globals.TotalCount;
             continue;
         }
         UsingPassword(inputFilePath, passwordBytes);
     }
     Utilities.ZeroArray(passwordBytes);
     DisplayMessage.SuccessfullyEncrypted();
 }
Exemple #2
0
 public static void EncryptEachFileWithPrivateKey(string[] filePaths, byte[] privateKey)
 {
     Globals.TotalCount = filePaths.Length;
     privateKey         = PrivateKey.Decrypt(privateKey);
     if (privateKey == null)
     {
         return;
     }
     foreach (string inputFilePath in filePaths)
     {
         bool validFilePath = FilePathValidation.FileEncryption(inputFilePath);
         if (!validFilePath)
         {
             --Globals.TotalCount;
             continue;
         }
         UsingPrivateKey(inputFilePath, privateKey);
     }
     Utilities.ZeroArray(privateKey);
     DisplayMessage.SuccessfullyEncrypted();
 }
Exemple #3
0
 public static void EncryptEachFileWithPublicKey(string[] filePaths, byte[] senderPrivateKey, byte[] recipientPublicKey)
 {
     Globals.TotalCount = filePaths.Length;
     senderPrivateKey   = PrivateKey.Decrypt(senderPrivateKey);
     if (senderPrivateKey == null)
     {
         return;
     }
     byte[] sharedSecret = KeyExchange.GetSharedSecret(senderPrivateKey, recipientPublicKey);
     Utilities.ZeroArray(senderPrivateKey);
     foreach (string inputFilePath in filePaths)
     {
         bool validFilePath = FilePathValidation.FileEncryption(inputFilePath);
         if (!validFilePath)
         {
             --Globals.TotalCount;
             continue;
         }
         UsingPublicKey(inputFilePath, sharedSecret, recipientPublicKey);
     }
     Utilities.ZeroArray(sharedSecret);
     DisplayMessage.SuccessfullyEncrypted();
 }