// execute Interface String realUrl = "HTTP: // localhost: 8091 / SzeportCodeService / MSGService / encryptAES" ; result = HttpUtil.post(realUrl, "data=aaaa");
Private static String Sign (String ywData) { // --------------------------- -------- call sign SzeportCodeService ------------------- // HTTP: // localhost : 8080 / SzeportCodeService / MSGService / the encrypt the JSONObject obj = new new the JSONObject (); String result = null; obj.put("data", ywData); obj.put("privateKey", Config.getProperty("PRIKEY_YLF")); //执行接口 String realUrl = Config.getProperty("szeportCodeServiceUrl")+Config.getProperty("szeportCodeServiceSign"); Result = HttpUtil.post (realUrl, obj.toJSONString ()); // Get data returned the JSONObject for resultObj = JSONObject.parseObject (Result); return resultObj.getString ( "Data" ); // --------------------------- call "third-party tools" to sign ------------- -------------- / * JSONObject obj = new JSONObject(); obj.put("data", ywData); //String ywsource = obj.toJSONString(); Sign sign = new Sign(SignAlgorithm.SHA1withRSA, PRIKEY_YLF, null); byte[] encrypt = sign.sign(StrUtil.bytes(ywData, CharsetUtil.CHARSET_UTF_8)); return Base64.encode(encrypt); * / }
// below are definitions corresponding to the form of the interface of the background