private void param_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName == GeneralParam.Fields.Encrypt) { GeneralParam param = (GeneralParam)sender; String intialValue = param.Value; bool res = false; if (!string.IsNullOrEmpty(intialValue)) { if (param.Encrypt == true) { if (!EncryptionHandler.IsStringEncrypted(intialValue)) { param.Value = EncryptionHandler.EncryptString(intialValue, ref res); if (res == false) { param.Value = null; } } } else { if (EncryptionHandler.IsStringEncrypted(intialValue)) { param.Value = EncryptionHandler.DecryptString(intialValue, ref res); if (res == false) { param.Value = null; } } } } } }
private async void grdMain_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { if (e.Column.Header.ToString() == "User Password") { Database selectedEnvDB = (Database)grdAppDbs.CurrentItem; String intialValue = selectedEnvDB.Pass; if (!string.IsNullOrEmpty(intialValue)) { bool res = false; if (!EncryptionHandler.IsStringEncrypted(intialValue)) { selectedEnvDB.Pass = EncryptionHandler.EncryptString(intialValue, ref res); if (res == false) { selectedEnvDB.Pass = null; } } } } if (e.Column.Header.ToString() == nameof(Database.Name)) { Database selectedDB = (Database)grdAppDbs.CurrentItem; if (selectedDB.Name != selectedDB.NameBeforeEdit) { await UpdateDatabaseNameChange(selectedDB); } } }
private void xSMTPPassTextBox_LostFocus(object sender, RoutedEventArgs e) { if (!EncryptionHandler.IsStringEncrypted(xSMTPPassTextBox.Text)) { xSMTPPassTextBox.Text = EncryptionHandler.EncryptwithKey(xSMTPPassTextBox.Text); } }
private void txtPasswordValue_LostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) { if (!EncryptionHandler.IsStringEncrypted(txtPasswordValue.Text)) { txtPasswordValue.Text = EncryptionHandler.EncryptwithKey(txtPasswordValue.Text); } }
private async void grdMain_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { if (e.Column.Header.ToString() == "User Password") { Database selectedEnvDB = (Database)grdAppDbs.CurrentItem; String intialValue = selectedEnvDB.Pass; //if Pass is stored in the form of variable, encryption not required at this stage if (!string.IsNullOrEmpty(intialValue) && !intialValue.Contains("{Var Name")) { if (!EncryptionHandler.IsStringEncrypted(intialValue)) { selectedEnvDB.Pass = EncryptionHandler.EncryptwithKey(intialValue); if (string.IsNullOrEmpty(selectedEnvDB.Pass)) { selectedEnvDB.Pass = null; } } } } if (e.Column.Header.ToString() == nameof(Database.Name)) { Database selectedDB = (Database)grdAppDbs.CurrentItem; if (selectedDB.Name != ((DatabaseOperations)selectedDB.DatabaseOperations).NameBeforeEdit) { await UpdateDatabaseNameChange(selectedDB); } } }
public void EncryptGridValues() { foreach (GingerCore.Variables.VariablePasswordString vp in xSolutionPasswordsParamtersGrid.DataSourceList) { if (!string.IsNullOrEmpty(vp.Password) && !EncryptionHandler.IsStringEncrypted(vp.Password)) { vp.Password = EncryptionHandler.EncryptwithKey(vp.Password); } } }
public void IsEncryptedTrue() { //Arrange string strToDecry = "+2FvQl58QkZC0d7ebO19SA=="; bool IsDecrypt; //Act IsDecrypt = EncryptionHandler.IsStringEncrypted(strToDecry); //Assert Assert.AreEqual(true, IsDecrypt); }
public void IsEncryptedFalse() { //Arrange string strToDecry = "erer"; bool IsDecrypt; //Act IsDecrypt = EncryptionHandler.IsStringEncrypted(strToDecry); //Assert Assert.AreEqual(false, IsDecrypt); }
private void txtPasswordValue_LostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) { bool res = false; if (!EncryptionHandler.IsStringEncrypted(txtPasswordValue.Text)) { txtPasswordValue.Text = EncryptionHandler.EncryptString(txtPasswordValue.Text, ref res); if (res == false) { txtPasswordValue.Text = string.Empty; } } }
private void xSMTPPassTextBox_LostFocus(object sender, RoutedEventArgs e) { bool res = false; if (!EncryptionHandler.IsStringEncrypted(xSMTPPassTextBox.Text)) { xSMTPPassTextBox.Text = EncryptionHandler.EncryptString(xSMTPPassTextBox.Text, ref res); if (res == false) { xSMTPPassTextBox.Text = string.Empty; } } }
private void grdMain_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { if (e.Column.Header.ToString() == GeneralParam.Fields.Name) { GeneralParam changedParam = (GeneralParam)grdAppParams.CurrentItem; if (changedParam.Name != changedParam.NameBeforeEdit) { //ask user if want us to update the parameter name in all BF's if (Reporter.ToUser(eUserMsgKeys.ChangingEnvironmentParameterValue) == MessageBoxResult.Yes) { UpdateVariableNameChange(changedParam); } } } else if (e.Column.Header.ToString() == GeneralParam.Fields.Value) { GeneralParam selectedEnvParam = (GeneralParam)grdAppParams.CurrentItem; String intialValue = selectedEnvParam.Value; bool res = false; if (!string.IsNullOrEmpty(intialValue)) { if (selectedEnvParam.Encrypt == true) { //UpdateVariableNameChange(selectedEnvParam); // why is that needed here? if (!EncryptionHandler.IsStringEncrypted(intialValue)) { selectedEnvParam.Value = EncryptionHandler.EncryptString(intialValue, ref res); if (res == false) { selectedEnvParam.Value = null; } } } else { if (EncryptionHandler.IsStringEncrypted(intialValue)) { selectedEnvParam.Value = EncryptionHandler.DecryptString(intialValue, ref res); if (res == false) { selectedEnvParam.Value = null; } } } } } }
private void grdMain_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { if (e.Column.Header.ToString() == "User Password") { Database selectedEnvDB = (Database)grdAppDbs.CurrentItem; String intialValue = selectedEnvDB.Pass; if (!string.IsNullOrEmpty(intialValue)) { bool res = false; if (!EncryptionHandler.IsStringEncrypted(intialValue)) { selectedEnvDB.Pass = EncryptionHandler.EncryptString(intialValue, ref res); if (res == false) { selectedEnvDB.Pass = null; } } } } }