Day5-4测试积点任务
问题:public static void testPassInfo(){
try {
Map<String,String> map=new HashMap<String, String>();
// String url="http://localhost:8087/service/dataService/invoke";
//String url="http://192.168.1.2:8081/dataService/invoke";
String url="http://117.78.49.154:18089/UdataService/dataService/invoke";
String tradeNo="411121199011074513"; //请求编号 ,要求每次不同,长度位22
String aesKey= AESUtil.getAutoCreateAESKey();
System.out.println("aesKey:"+aesKey);
String bodyInfo="{\n" +
" \"name\": \"关星\",\n" +
" \"idno\": \"411121199011074511\",\n" +
" \"idtype\": \"IDENTITY_CARD\",\n" +
" \"mobile\": \"18616777353\",\n" +
" \"cardno\": \"6212261001037530688\"\n" +
"}";
String headInfo="{\n" +
" \"merchantCode\": \""+MERCHANTCODE+"\",\n" +
" \"loginName\": \""+LOGINNAME+"\",\n" +
" \"password\": \""+ RSAUtil.encryptByPublicKey(PASSWORD,PUBKEY)+"\",\n" +
" \"tradeNo\": \""+tradeNo+"\",\n" +
" \"serviceCode\": \""+SERVICECODE+"\",\n" +
" \"aesKey\": \""+ RSAUtil.encryptByPublicKey(aesKey,PUBKEY)+"\"\n" +
"}";
bodyInfo=AESUtil.encryptByAES(bodyInfo,aesKey);
String data="{\"body\":\""+bodyInfo+"\",\"head\":"+headInfo+"}";
System.out.println("data:"+data);
map.put("data",data);
String str=sendPostSSLRequest(url,map,"UTF-8");
System.out.println("加解密测试str:"+str);
//解密body信息
JSONObject strJson=JSONObject.parseObject(str);
String bodyAesInfo=strJson.getString("body");
JSONObject headJson=JSONObject.parseObject(strJson.getString("head"));
aesKey=RSAUtil.decryptByPublicKey(headJson.getString("aesKey"),PUBKEY);
System.out.println("bodyAesInfo:"+bodyAesInfo+",aesKey:"+aesKey);
bodyAesInfo=AESUtil.decryptByAES(bodyAesInfo,aesKey);
System.out.println("bodyAesInfo:"+bodyAesInfo);
} catch (Exception e) {
//异常根据实际情况处理
e.printStackTrace();
}
}
这个有什么问题? 你的问题是什么呀:L 这题送分了 什么问题 送分题,哈哈哈哈哈
页:
[1]