예제 #1
0
 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();
     }
 }
예제 #2
0
        /// <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();
        }