public void GivenAnOriginalText_WhenEncrypt_ResultShouldBeValidAndDecryptable(string originalText) { var cipherText = EncryptUtility.EncryptTextToBase64WithAes(originalText, Key); var plainText = EncryptUtility.DecryptTextFromBase64WithAes(cipherText, Key); Assert.Equal(originalText, plainText); }
public ProcessResult Process(ElementNode node, ProcessContext context = null, Dictionary <string, object> settings = null) { var processResult = new ProcessResult(); if (string.IsNullOrEmpty(node?.Value?.ToString())) { return(processResult); } var input = node.Value.ToString(); node.Value = EncryptUtility.EncryptTextToBase64WithAes(input, _key); _logger.LogDebug($"Fhir value '{input}' at '{node.Location}' is encrypted to '{node.Value}'."); processResult.AddProcessRecord(AnonymizationOperations.Encrypt, node); return(processResult); }