Beispiel #1
0
        private static void FileDecryptionWithPassword(char[] password, string keyfilePath, string[] filePaths)
        {
            bool validUserInput = FileEncryptionValidation.FileEncryptionWithPassword(password, keyfilePath, filePaths);

            if (!validUserInput)
            {
                return;
            }
            byte[] passwordBytes = Password.Hash(password, keyfilePath);
            FileDecryption.DecryptEachFileWithPassword(filePaths, passwordBytes);
        }
Beispiel #2
0
        private static void FileDecryptionWithPrivateKey(string privateKeyPath, string[] filePaths)
        {
            bool validUserInput = FileEncryptionValidation.FileEncryptionWithPrivateKey(privateKeyPath, filePaths);

            if (!validUserInput)
            {
                return;
            }
            byte[] privateKey = AsymmetricKeyValidation.EncryptionPrivateKeyFile(privateKeyPath);
            if (privateKey == null)
            {
                return;
            }
            FileDecryption.DecryptEachFileWithPrivateKey(filePaths, privateKey);
        }
Beispiel #3
0
        private static void FileEncryptionWithPublicKey(string senderPrivateKeyPath, char[] recipientPublicKeyString, string[] filePaths)
        {
            bool validUserInput = FileEncryptionValidation.FileEncryptionWithPublicKey(senderPrivateKeyPath, recipientPublicKeyString, filePaths);

            if (!validUserInput)
            {
                return;
            }
            byte[] senderPrivateKey = AsymmetricKeyValidation.EncryptionPrivateKeyFile(senderPrivateKeyPath);
            if (senderPrivateKey == null)
            {
                return;
            }
            byte[] recipientPublicKey = AsymmetricKeyValidation.EncryptionPublicKeyString(recipientPublicKeyString);
            if (recipientPublicKey == null)
            {
                return;
            }
            FileEncryption.EncryptEachFileWithPublicKey(filePaths, senderPrivateKey, recipientPublicKey);
        }