//执行接口
String realUrl = "http://localhost:8091/SzeportCodeService/MSGService/encryptAES";
result = HttpUtil.post(realUrl, "data=aaaa");
private static String sign(String ywData){
//---------------------------调用SzeportCodeService进行签名---------------------------
//http://localhost:8080/SzeportCodeService/MSGService/encrypt
JSONObject obj = new 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());
//获取返回的数据
JSONObject resultObj = JSONObject.parseObject(result);
return resultObj.getString("data");
//---------------------------调用 "第三方工具" 进行签名---------------------------
/*
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);
*/
}
//下面对应的是后台接口的定义形式