public void When_encrypt_And_decrypt_Then_plaintext_are_the_same() { var cipher = _sut.Encrypt(Plaintext); var plaintext = _sut.Decrypt(cipher.cipherText, cipher.entropy); Assert.AreEqual(Plaintext, plaintext); }
public async Task Encrypt(string sourcePath, string outputPath) { _stringValidator.IsNullOrWhitespace(sourcePath, nameof(sourcePath)); _stringValidator.IsNullOrWhitespace(outputPath, nameof(outputPath)); var entropyPath = GetEntropyFilePath(outputPath); _fileValidator.IsExist(sourcePath); _fileValidator.IsNotExist(outputPath); _fileValidator.IsNotExist(entropyPath); var content = await _diskService.ReadFileText(sourcePath); var cipher = _pbkdF2Service.Encrypt(content); await _diskService.WriteFileText(cipher.cipherText, outputPath); await _diskService.WriteFileText(cipher.entropy, entropyPath); }