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(); }
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(); }
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(); }