Using dscf.bpl.informationauditbpl;using dscf.bpl.productbpl;using dscf.global.commonaduit;using Dscf.Global.Model ; using system;using system.collections.generic;using system.linq;using system.web;using System.web.script.serialization;using litjson;using dscf.client.informationauditweb.app_start;using System.configuration;using system.web.sessionstate;using dscf.bpl.userbpl;using Newtonsoft.Json.Linq;using Newtonsoft.json;using system.text;using org.bouncycastle.crypto.encodings;using Org.BouncyCastle.Crypto.Engines; namespace dscf.client.informationauditweb.handler{ //<summary> //Zhichenghandler Summary description //</summary> public class Zhichenghandler:ihttphandler, Ireadonlysessionstate, irequiressessionstate { public void ProcessRequest (HttpContext context) & nbsp { String type = context. request["type"]; context. Response.ContentType = "Text/plain"; switch (type) &NB Sp { case "0"://Query display & nbsp { context. Response.Write (GetUserInfo); B reak; } &NBS P Case "1"://Borrowing display { & nbsp context. Response.Write (Loadselect (context)); BR eak; &NBSp } } } <summary> //Enquiry Personnel information //</summary> & nbsp //<param name= "context" ></param> //<returns></returns>& nbsp Public Userinfomodel Getuserinfomodel (Userinfomodel model) { Userinfomodel userinfo = new Userinfomodel (); TRY&NB Sp { UserInfo = Userinfobpl.queryob Ject (model); return userinfo; &NB Sp } catch (Exception ex) { &N Bsp   } return userinfo; } //<summary> //Return results //</summary> &nbs P //<param name= "url" ></param> //<param name= "parameters" >& lt;/param> //<returns></returns> public static str ing responsebind (string url, idictionary<string, string> parameters) { &NBS P Securityutils su = new securityutils ();//value string Strreturn = su. Returnactionfromxml (URL, parameters); //jobject Jo = (jobject) Jsonconvert.deserializeobject (Strreturn); //string responsestr = jo["Response" ]! = null? jo["Response"]. TostrING (). Trim (): "";//Execution Results //jobject Jo2 = (jobject) jsonconvert.deserializeobject (respon SESTR); //return jo2; return strreturn;& nbsp } //<summary> //Get personal information & nbsp //</summary> //<param name= "context" ></param> /<returns></returns> public resultmessage GetUserInfo ( HttpContext context) { try { int orderid; &NBS P if (int. TryParse (context. request["Userid"], out orderId)) { &NBSp Userinfomodel userinfo = new Userinfomodel (); UserInfo. UserId = Convert.ToInt32 (context. request["Userid"]); userinfo = Getuserinfomodel (useri NFO); if (userinfo! = null) &NBSP ; { &N Bsp return new Resultmessage (true, "success", UserInfo); }&NBS P else { return new Resultmessa GE (False, "failed"); &NBSP } } & nbsp else { &NBSP ; return new Resultmessage (false, "no data! "); } } &NBSP ; catch (Exception ex) { &NB Sp return new Resultmessage (false, ex. Message); } } //<summa ry> // Borrowing enquiry //</summary> &NBS P <param name= "context" ></param> //<returns></returns> / nbsp &NBSp Public Resultmessage Loadselect (HttpContext context) { try { int orderid; if (int. TryParse (context. request["Userid"], out orderId)) { &NBSP ; Userinfomodel userinfo = new Userinfomodel (); UserInfo. UserId = Convert.ToInt32 (context. request["Userid"]); userinfo = Getuserinfomodel (useri NFO); if (userinfo! = null) &NBSP ; { &NBSp //Read file using (var fileStream = S) Ystem. Io. File.OpenText (context. Server.MapPath ("/attached/publickey/zc_publickey_v2.pem")) { &N Bsp var pemreader = new Org.BouncyCastle.OpenSsl.PemReader (fileStream); &NBSP ; var keyparameter = (Org.BouncyCastle.Crypto.AsymmetricKeyParameter) Pemreader.readobject (); / /userid String input = "D Ingsheng_testusr "; byte[] TeStdata = Encoding.UTF8.GetBytes (input); var decryptengine = new Pkcs1encoding (new Rsaengine ()); &NB Sp Decryptengine.init (True, Keyparameter); input = convert.tobase64string (Decryptengine.processblock (TESTDA TA, 0, testdata.length); params Zhichengloanser Achmodel Zhichengloanserachmodel = new Zhichengloanserachmodel (); nbsp Zhichengloanserachmodel.name = userinfo. name; andnbsp Zhichengloanserachmodel.idtype = "101"; Zhichengloanserachmodel.idno = userinfo. idcard; Zhichengloanserac Hmodel.queryreason = "Ten"; &NBSP ; Serialization of objects into json SERIALIZERH Elper serializer = new Serializerhelper (); &NB Sp string param = Jsonconvert.serializeobject (zhichengloanserachmodel); & nbsp testData = Encoding.UTF8.GetBytes (param); &NBS P &NBSP TestData = new Rc4crypto (). Encryptex (TestData, "Bd3fe9f1bf134f50"); &NBSP ; param = convert.tobase64string (testData); &NBS P idictionary<string, string> parameters = new dictionary<string, string> (); parameters . ADD ("userid", Httputility.urlencode (input)); & nbsp parameters. ADD ("params", Httputility.urlencode (param)); nbsp //Resolve request Results Se Curityutils su = new securityutils (); &NBsp String _crediturl = "Http://www.zhichengcredit.com/CreditPo Rtal/api/queryloan/v2 "; s Tring result = su. Returnactionfromxml (_crediturl, parameters); and nbsp Jobject Jo = jobject.parse (result); &NB Sp String data = jo["Data"]. ToString (); var resultstr = new Rc4crypto (). Decrypt (data, "BD3FE9F1BF134F50", CryptoBase.EncoderMode.Base64Encoder); String json = Httputility.urldecode (resultstr); &NBSP ; &NBSP; var model = jsonconvert.deserializeobject<zhichengloanseachresultmodel> (JSON); &NBSP ; return new Resultmessage (true, "success", model); & nbsp } &N Bsp return new Resultmessage (true, "success", UserInfo); }& nbsp else { return new Resultmessa GE (False, "failed"); } } else &NBS P { return new Resultmessage (false, "no data! "); } } &NBSP ; catch (Exception ex) { &NB Sp return new Resultmessage (false, ex. Message); } } public bool I sreusable { get &NBS P { return false; } &N Bsp } }}
C # operation Pem file