private static askForPasswordAndCompareToHashedPassword ( string sebFileHashedAdminPassword, bool forEditing ) : bool | ||
sebFileHashedAdminPassword | string | |
forEditing | bool | |
return | bool |
private static Dictionary <string, object> GetPreferencesDictFromConfigData(byte[] sebData, bool forEditing) { Dictionary <string, object> dictionary; try { dictionary = (Dictionary <string, object>)Plist.readPlist(sebData); } catch (Exception ex) { int num = (int)SEBMessageBox.Show(SEBUIStrings.loadingSettingsFailed, SEBUIStrings.loadingSettingsFailedReason, MessageBoxIcon.Hand, MessageBoxButtons.OK, forEditing); Console.WriteLine(ex.Message); return((Dictionary <string, object>)null); } if (forEditing) { string str = (string)SEBSettings.valueForDictionaryKey(dictionary, "hashedAdminPassword"); if (!string.IsNullOrEmpty(str) && (string.Compare((string)SEBSettings.valueForDictionaryKey(SEBSettings.settingsCurrent, "hashedAdminPassword") ?? "", str, StringComparison.OrdinalIgnoreCase) != 0 && !SEBConfigFileManager.askForPasswordAndCompareToHashedPassword(str, forEditing))) { return((Dictionary <string, object>)null); } } return(dictionary); }
private static Dictionary <string, object> DecryptDataWithPasswordForConfiguringClient(byte[] sebData, bool forEditing, ref string sebFilePassword, ref bool passwordIsHash) { passwordIsHash = false; string upper = ((string)SEBSettings.valueForDictionaryKey(SEBSettings.settingsCurrent, "hashedAdminPassword") ?? "").ToUpper(); byte[] input1 = SEBProtectionController.DecryptDataWithPassword(sebData, upper); string str1; if (input1 == null) { input1 = SEBProtectionController.DecryptDataWithPassword(sebData, ""); if (input1 == null) { int num1 = 5; str1 = (string)null; string passwordRequestText = SEBUIStrings.enterEncryptionPassword; string input2; do { --num1; input2 = ThreadedDialog.ShowPasswordDialogForm(SEBUIStrings.reconfiguringLocalSettings, passwordRequestText); if (input2 == null) { return((Dictionary <string, object>)null); } string passwordHash = SEBProtectionController.ComputePasswordHash(input2); input1 = SEBProtectionController.DecryptDataWithPassword(sebData, passwordHash); passwordRequestText = SEBUIStrings.enterEncryptionPasswordAgain; }while (input1 == null && num1 > 0); if (input1 == null) { int num2 = (int)SEBMessageBox.Show(SEBUIStrings.reconfiguringLocalSettingsFailed, SEBUIStrings.reconfiguringLocalSettingsFailedWrongPassword, MessageBoxIcon.Hand, MessageBoxButtons.OK, forEditing); return((Dictionary <string, object>)null); } if (forEditing) { sebFilePassword = input2; } } } else { sebFilePassword = upper; passwordIsHash = true; } byte[] data = GZipByte.Decompress(input1); Dictionary <string, object> dictionary; try { dictionary = (Dictionary <string, object>)Plist.readPlist(data); } catch (Exception ex) { int num = (int)SEBMessageBox.Show(SEBUIStrings.loadingSettingsFailed, SEBUIStrings.loadingSettingsFailedReason, MessageBoxIcon.Hand, MessageBoxButtons.OK, forEditing); Console.WriteLine(ex.Message); return((Dictionary <string, object>)null); } string str2 = (string)SEBSettings.valueForDictionaryKey(dictionary, "hashedAdminPassword") ?? ""; if (string.Compare(upper, str2, StringComparison.OrdinalIgnoreCase) != 0) { if (forEditing) { if (!SEBConfigFileManager.askForPasswordAndCompareToHashedPassword(str2, forEditing)) { return((Dictionary <string, object>)null); } } else if (!passwordIsHash && upper.Length > 0) { int num1 = 5; str1 = (string)null; string passwordRequestText = SEBUIStrings.enterCurrentAdminPwdForReconfiguring; bool flag; do { --num1; string input2 = ThreadedDialog.ShowPasswordDialogForm(SEBUIStrings.reconfiguringLocalSettings, passwordRequestText); if (input2 == null) { return((Dictionary <string, object>)null); } flag = string.Compare(input2.Length != 0 ? SEBProtectionController.ComputePasswordHash(input2) : "", upper, StringComparison.OrdinalIgnoreCase) == 0; passwordRequestText = SEBUIStrings.enterCurrentAdminPwdForReconfiguringAgain; }while (!flag && num1 > 0); if (!flag) { int num2 = (int)SEBMessageBox.Show(SEBUIStrings.reconfiguringLocalSettingsFailed, SEBUIStrings.reconfiguringLocalSettingsFailedWrongCurrentAdminPwd, MessageBoxIcon.Hand, MessageBoxButtons.OK, forEditing); return((Dictionary <string, object>)null); } } } dictionary["sebConfigPurpose"] = (object)1; return(dictionary); }