public string SetPassword(string id, string pass) { string result = string.Empty; try { string enc_pass = CSecureUtil.Encrypt(pass); /** * 여기에 ID와 패스워드를 이용하여 DB의 데이터 변경 작업을 한다. * * // 예시 * StringBuilder param = new StringBuilder(); * param.Append(id); * param.Append(CConst.DB_PARAM_DELIMITER).Append(enc_pass); * * // DB작업 * //DataSet ds = WebSql.SelectSql(호출프로시저번호, param.ToString()); * DataSet ds = WebSql.SelectSql(3805, param.ToString()); * * * */ // XML로 결과값 리턴 result = XmlUtil.GetSingleXml(enc_pass); } catch (Exception e) { Debug.WriteLine(e.ToString()); } return(result); }
public string Decrypt(string input) { string result = string.Empty; // XML로 변환 result = XmlUtil.GetSingleXml(CSecureUtil.Decrypt(input, "abcdefghijklmnopqrstuvwxyz123456")); return(result); }
public string Encrypt(string input) { string result = string.Empty; // XML로 결과값 리턴 result = XmlUtil.GetSingleXml(CSecureUtil.Encrypt(input)); return(result); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SearchData(); SetControls(); } string result = CSecureUtil.Decrypt("PGXjU6ib2mKYwtrh2i3fIQ==", "abcdefghijklmnopqrstuvwxyz123456"); }
/// <summary> /// 데이터 셋팅(레코드셋 여러개) /// 페이지 단에서 가져올 때 = GetData(int tableNum, int rowNum, string colName) 종류의 메소드 사용 /// </summary> /// <param name="procIndex">프로시저 Index</param> /// <param name="param">"|" 연결된 파라미터 조합</param> protected void SetDataTableList(int procIndex, string param) { try { mds = WebSql.SelectSql(procIndex, CSecureUtil.CheckString(param)); } catch (Exception e) { CLog.debug(logger, "PageBase.SetDataList(" + procIndex + "," + param + ") : " + e.Message); } }
/// <summary> /// 데이터 조회 /// </summary> /// <param name="procIndex"></param> /// <param name="param"></param> /// <returns></returns> protected DataSet GetDataSet(int procIndex, string param) { try { return(WebSql.SelectSql(procIndex, CSecureUtil.CheckString(param))); } catch (Exception e) { CLog.debug(logger, "PageBase.GetDataSet(" + procIndex + "," + param + ") : " + e.Message); } return(null); }
/// <summary> /// 데이터 셋팅(레코드셋 1개 = 0번째 테이블) /// </summary> /// <param name="procIndex">프로시저 Index</param> /// <param name="param">"|" 연결된 파라미터 조합</param> protected void SetDataList(int procIndex, string param) { try { DataSet mds = WebSql.SelectSql(procIndex, CSecureUtil.CheckString(param)); dataRow = mds.Tables[0].Select(); System.Diagnostics.Debug.WriteLine("dataRow=" + dataRow); } catch (Exception e) { CLog.debug(logger, "PageBase.SetDataList(" + procIndex + "," + param + ") : " + e.Message); } }
/// <summary> /// 레코드 총 수(레코드셋 1개 = 0번째 테이블) /// </summary> /// <param name="procIndex"></param> /// <param name="param"></param> protected void SetDataCount(int procIndex, string param) { try { DataSet ds = WebSql.SelectSql(procIndex, CSecureUtil.CheckString(param)); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { dataTotalCount = Convert.ToInt32(ds.Tables[0].Select()[0][0]); } } catch (Exception e) { CLog.debug(logger, "PageBase.SetDataCount(" + procIndex + "," + param + ") : " + e.Message); } }
/// <summary> /// 관리자 상세 조회 /// </summary> private void SetDetailAdmin() { StringBuilder param = new StringBuilder(); param.Append(Request["admin_id"]); ds = GetDataSet(3801, param.ToString()); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { sys_insert_member_id.Value = ds.Tables[0].Rows[0]["ADMIN_ID"].ToString(); sys_insert_member_nm.Value = ds.Tables[0].Rows[0]["ADMIN_NM"].ToString(); // Password 필드가 안채워져 고민중 sys_insert_member_pwd.Attributes.Add("value", CSecureUtil.Decrypt(ds.Tables[0].Rows[0]["ADMIN_PW"].ToString(), CConst.SECURIT_KEY)); } }
/// <summary> /// 로그인 /// </summary> private void GetLogin() { string password = string.Empty; if (CStringUtil.IsNullOrEmpty(admin_pw.Value) == false) { string password_enc = CSecureUtil.Encrypt(admin_pw.Value); //System.Diagnostics.Trace.WriteLine(password_enc); StringBuilder param = new StringBuilder(); param.Append(admin_id.Value); param.Append(CConst.DB_PARAM_DELIMITER).Append(admin_pw.Value); param.Append(CConst.DB_PARAM_DELIMITER).Append(password_enc); SetDataList(3000, param.ToString()); if (CStringUtil.IsNullOrEmpty(GetData(0, 0)) == false) { // 로그인 설정 및 시작 메뉴 URL을 가져온다. string startupUrl = SetLoginInfo(); if (CStringUtil.IsNullOrEmpty(startupUrl)) { ClientScript.RegisterClientScriptBlock(this.GetType(), "test", CWebUtil.MsgBox("접근 권한이 없습니다.")); } else { Response.Redirect(startupUrl); } } else { ClientScript.RegisterClientScriptBlock(this.GetType(), "test", CWebUtil.MsgBox("아이디 또는 비밀번호가 다릅니다.")); } } else { ClientScript.RegisterClientScriptBlock(this.GetType(), "test", CWebUtil.MsgBox("비밀번호가 입력되지 않았습니다.")); } }
/// <summary> /// 관리자 정보 수정 /// </summary> private void ModifyAdminData() { string adminPwd = CSecureUtil.Encrypt(sys_insert_member_pwd.Value); StringBuilder param = new StringBuilder(); param.Append(sys_insert_member_id.Value); param.Append(CConst.DB_PARAM_DELIMITER).Append(sys_insert_member_nm.Value); param.Append(CConst.DB_PARAM_DELIMITER).Append(adminPwd); string[] result = ExecuteQueryResult(3803, param.ToString()); if (result == null) { ClientScript.RegisterClientScriptBlock(this.GetType(), "test", CWebUtil.MsgBox("시스템 오류가 발생 했습니다.")); } else if (result[0].Equals("00") == false) { // 수정 실패 ClientScript.RegisterClientScriptBlock(this.GetType(), "test", CWebUtil.MsgBox(result[1])); } }