public void Action(string keyFile, string inputFile) { if (String.IsNullOrEmpty(keyFile)) { throw new ArgumentNullException(nameof(keyFile)); } if (String.IsNullOrEmpty(inputFile)) { throw new ArgumentNullException(nameof(inputFile)); } if (!this.FileSystem.Exists(keyFile)) { throw new FileNotFoundException(keyFile); } if (!this.FileSystem.Exists(inputFile)) { throw new FileNotFoundException(inputFile); } string outputFile = inputFile.Replace(".encrypted", ".decrypted"); byte[] key = this.FileSystem.ReadAllBytes(keyFile); byte[] encrytpedData = this.FileSystem.ReadAllBytes(inputFile); byte[] clearData = AesCryptography.DecryptWithAes(encrytpedData, key); this.FileSystem.WriteAllBytes(outputFile, clearData); }