|
|
@ -82,7 +82,7 @@ public class RetailRSvcServiceImpl implements RetailRSvcService {
|
|
|
|
throw new BadRequestException("this channel config is wrong");
|
|
|
|
throw new BadRequestException("this channel config is wrong");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String signa = params.getString("sign");
|
|
|
|
String signa = params.getString("sign");
|
|
|
|
params.remove(signa);
|
|
|
|
params.remove("sign");
|
|
|
|
params = JSONObject.parseObject(JSON.toJSONString(params), Feature.OrderedField);
|
|
|
|
params = JSONObject.parseObject(JSON.toJSONString(params), Feature.OrderedField);
|
|
|
|
boolean checkSign = SignUtils.validSign(params.toJSONString(), signa, svcInfo.getString("channel_pub_key"));
|
|
|
|
boolean checkSign = SignUtils.validSign(params.toJSONString(), signa, svcInfo.getString("channel_pub_key"));
|
|
|
|
if (!checkSign) {
|
|
|
|
if (!checkSign) {
|
|
|
@ -92,8 +92,7 @@ public class RetailRSvcServiceImpl implements RetailRSvcService {
|
|
|
|
if (client == null) {
|
|
|
|
if (client == null) {
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String aesKeyStr = Base64.encodeBase64String(AESCrypt.randomKey().getEncoded());
|
|
|
|
Key key = AESCrypt.fromKeyString(Base64.decodeBase64(params.getString("nonce_str")));
|
|
|
|
Key key = AESCrypt.fromKeyString(Base64.decodeBase64(aesKeyStr));
|
|
|
|
|
|
|
|
JSONObject serviceApply = new JSONObject();
|
|
|
|
JSONObject serviceApply = new JSONObject();
|
|
|
|
serviceApply.put("apply_id", UUID.randomUUID().toString());
|
|
|
|
serviceApply.put("apply_id", UUID.randomUUID().toString());
|
|
|
|
serviceApply.put("service_code", sourceCode);
|
|
|
|
serviceApply.put("service_code", sourceCode);
|
|
|
@ -108,6 +107,7 @@ public class RetailRSvcServiceImpl implements RetailRSvcService {
|
|
|
|
clientServicesApplyMapper.save(serviceApply);
|
|
|
|
clientServicesApplyMapper.save(serviceApply);
|
|
|
|
result.put("result_status", "PROCESSING");
|
|
|
|
result.put("result_status", "PROCESSING");
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
logger.error("enter R services fail:{} - {}",sourceCode,e.getMessage());
|
|
|
|
result.put("result_status", "SYSTEMERROR");
|
|
|
|
result.put("result_status", "SYSTEMERROR");
|
|
|
|
result.put("result_msg", e.getMessage());
|
|
|
|
result.put("result_msg", e.getMessage());
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -120,7 +120,7 @@ public class RetailRSvcServiceImpl implements RetailRSvcService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private String decData(String data, Key key, String privateKey) {
|
|
|
|
private String decData(String data, Key key, String privateKey) {
|
|
|
|
String priKeyDecData = SignUtils.decData(data, privateKey);
|
|
|
|
String aesData = new String(AESCrypt.decrypt(Base64.decodeBase64(data), key), StandardCharsets.UTF_8);
|
|
|
|
return org.apache.commons.codec.binary.Base64.encodeBase64String(AESCrypt.encrypt(priKeyDecData.getBytes(StandardCharsets.UTF_8), key));
|
|
|
|
return SignUtils.decData(aesData, privateKey);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|