public void Test_Cipher_Aes() { var list = new List <string>(); var list1 = list.Where(l => l.Equals("r")).ToList(); string str23 = string.Format("{0}_{1}_{2}", 1, 2, 4); var mail = new MailBinding() { uid = "30533", u_name = "newqqqqq", email = "*****@*****.**" }; var str = "{\"Org_Android_Version\":\"3.0.1\",\"cl_cookieId\":\"867922028675582\",\"cl_screenSize\":\"KIW - TL00H\",\"cl_token\":\"h4DFuGvB2pFCkKs1rqKbU1MUG5pwfMcu9G3QLrWuKSDmX9mpYNAQNGz2mps1nSAELM1sgpWd5k18KKDG3KzRmSnII1wDtU1G4arzpOceuUA\u003d\"}"; //var json = "MLSRugdZezCbdpK8ZdjPQyu+5mBikdEVEaRvNsLcsJbiZKeSf6hGE0Bexwc/JBoPkFB8XAFLOpod7DvyEr/geVYeqv+5mnQh8KQ1yt+lS4Tj6rU3wJW6/TioCld1IRGM3A/uIrPpQB+WsX+SlSaOGwY1Qxtkfiz6GmwK2mQPf+OS6+K6i+HulFUV2FqIsj8Z1FQ +WjpkseEeurxS8/NHAkyiNivapFyOk+XsenR5yxpSzqcKmgzEYmjrqTHcB7asBDdk33U3dtvq7VmlUxmyv6xwxz5U2k2ueD2ok4Rz8YE="; var enstr = Cipher_Aes.DecryptFromBase64(raw_str, cipher_key1); var str1 = Cipher_Aes.EncryptToBase64(str, cipher_key); Assert.Equal("txttxt", str); }
public static Resp_Company_Detail To_Company_Detail(this Tuple <OrgCompanyDtlInfo, OrgCompanyListInfo> t) { var c = new Resp_Company_Detail(); if (t.Item1 != null) { var flag = t.Item1.od_CreateTime.Year != 1900; c.oc_code_s = Private_Util.To_Code_Display(t.Item1.od_oc_code) ?? string.Empty; c.oc_code = t.Item1.od_oc_code ?? string.Empty; c.oc_number = Private_Util.To_Number_Display(t.Item1.oc_number) ?? string.Empty; c.oc_name = t.Item1.oc_name ?? string.Empty; c.oc_addr = t.Item1.oc_address ?? string.Empty; c.oc_art_person = t.Item1.od_faRen ?? string.Empty; c.oc_business = t.Item1.od_bussinessDes ?? string.Empty; c.oc_reg_capital = t.Item1.od_regMoney ?? string.Empty; c.oc_paid_capital = t.Item1.od_factMoney ?? string.Empty; c.oc_reg_type = t.Item1.od_regType ?? string.Empty; c.oc_reg_date = t.Item1.od_regDate ?? string.Empty; c.oc_operate_time = flag ? (string.IsNullOrEmpty(t.Item1.od_bussinessS) ? "****" : t.Item1.od_bussinessS) + " 至 " + (string.IsNullOrEmpty(t.Item1.od_bussinessE) ? "永续经营" : t.Item1.od_bussinessE) : ""; c.oc_check_date = t.Item1.od_chkDate; c.oc_annual_review = t.Item1.od_yearChk; // generating time of this record c.oc_create_time = t.Item1.od_CreateTime.ToString("yyyy-MM-dd HH:mm"); c.oc_ext = t.Item1.od_ext ?? string.Empty; c.oc_status = Private_Util.Operation_Status_Get(c.oc_ext); } if (t.Item2 != null) { c.oc_detail_weburi = $"{ConfigurationManager.AppSettings["oc_detail_weburi"]}/?a=detail&c={HttpUtility.UrlEncode(Cipher_Aes.EncryptToBase64(t.Item2.oc_code, ConfigurationManager.AppSettings["code_key"]), Encoding.UTF8)}"; if (string.IsNullOrEmpty(c.oc_code_s)) { c.oc_code_s = Private_Util.To_Code_Display(t.Item2.oc_code); c.oc_code = t.Item2.oc_code; } c.oc_area = t.Item2.oc_area ?? string.Empty; c.oc_area_name = t.Item2.oc_areaName ?? string.Empty; if (string.IsNullOrEmpty(c.oc_name)) { c.oc_name = t.Item2.oc_name; } c.oc_type = t.Item2.oc_companytype; c.oc_reg_name = t.Item2.oc_regOrgName; c.oc_number = t.Item2.oc_number; if (string.IsNullOrEmpty(c.oc_number)) { c.oc_number = Private_Util.To_Number_Display(t.Item2.oc_number); } c.oc_creditcode = t.Item2.oc_creditcode; if (string.IsNullOrEmpty(c.oc_addr)) { c.oc_addr = t.Item2.oc_address; } c.oc_valid_period = t.Item2.oc_issuetime.ToString("yyyy-MM-dd") + " 至 " + t.Item2.oc_invalidtime.ToString("yyyy-MM-dd"); // 有效期 if (string.IsNullOrEmpty(c.oc_create_time)) { c.oc_create_time = t.Item2.oc_createTime.ToString("yyyy-MM-dd HH:mm"); } } return(c); }
/// <summary> /// AES encrypte with a specified key /// </summary> /// <param name="input"></param> /// <param name="key"></param> /// <returns></returns> public static string ToEncryption(this string input, string key = null) { return(Cipher_Aes.EncryptToBase64(input, key ?? Global.Instance.C_Dyn_Key)); }
/// <summary> /// Induce all fields to generate a token /// </summary> /// <returns></returns> public string Induce() { return(Cipher_Aes.EncryptToBase64(_fields.ToJson(), ConfigurationManager.AppSettings[Constants.S_Tok])); }