private void ShowSensible_Button_Click(object sender, RoutedEventArgs e) { try { if (!_showsSensible) { var decrypted = CryptMemProtection_ForUtilityProject.DecryptInMemoryData(_encryptedData); Sensible_Textblock.Text = ByteHelper.ByteArrayToString(decrypted); decrypted = null; _showsSensible = true; } else { Sensible_Textblock.Text = "*********************************"; _showsSensible = false; } } catch (Exception ex) { Logger.log.Error($"Couldn't handle sensible data: {ex}"); ex.SetUserMessage(WellKnownExceptionMessages.DataExceptionMessage()); Communication.InformUserAboutError(ex); _encryptedData = null; Close(); } }
/// <summary> /// Takes in a string shows them safely on demand for the user. /// </summary> /// <param name="encryptedData"></param> public static void ShowSensibleData(string data, string infoText, string title = "Info:") { // Implement this. var encryptedData = CryptMemProtection_ForUtilityProject.EncryptInMemoryData(ByteHelper.StringToByteArray(data)); data = string.Empty; var sensibleDataView = new SensibleDataView(encryptedData, infoText, title); sensibleDataView.Show(); }