[Y] R service 加密参数

master
taylor.dang 5 years ago
parent 3b46cf5926
commit 9ac244038a

@ -9,7 +9,7 @@
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>manage</artifactId> <artifactId>manage</artifactId>
<version>1.2.97</version> <version>1.3.0</version>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jib-maven-plugin.version>1.4.0</jib-maven-plugin.version> <jib-maven-plugin.version>1.4.0</jib-maven-plugin.version>
@ -212,6 +212,10 @@
<artifactId>HikariCP</artifactId> <artifactId>HikariCP</artifactId>
<version>3.2.0</version> <version>3.2.0</version>
</dependency> </dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>

@ -0,0 +1,3 @@
ALTER TABLE sys_incremental_channels ADD COLUMN channel_pub_key TEXT DEFAULT NULL AFTER source_code;
ALTER TABLE sys_incremental_channels ADD COLUMN platform_pub_key TEXT DEFAULT NULL AFTER channel_pub_key;
ALTER TABLE sys_incremental_channels ADD COLUMN platform_pri_key TEXT DEFAULT NULL AFTER platform_pub_key;

@ -0,0 +1,50 @@
package au.com.royalpay.payment.manage.appclient.beans;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class RSvcMchBean {
/**
*
*/
private String merchantNumber;
/**
* partnerCode
*/
private String partnerCode;
/**
* CredentialCode
*/
private String credentialCode;
/**
* HostpayHost
*/
private String payHost;
/**
* logo
*/
private String logo;
/**
*
*/
private String industryCode;
/**
*
*/
private String industryName;
/**
*
*/
private String merchantName;
}

@ -0,0 +1,14 @@
package au.com.royalpay.payment.manage.appclient.core;
import com.alibaba.fastjson.JSONObject;
public interface RetailRSvcService {
/**
* Appservice code
*
* @param device
* @param sourceCode
* @return
*/
JSONObject findMchInfoBySourceCode(JSONObject device, String sourceCode);
}

@ -0,0 +1,53 @@
package au.com.royalpay.payment.manage.appclient.core.impls;
import au.com.royalpay.payment.manage.appclient.beans.RSvcMchBean;
import au.com.royalpay.payment.manage.appclient.core.RetailRSvcService;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.tools.codec.AESCrypt;
import au.com.royalpay.payment.tools.device.DeviceSupport;
import au.com.royalpay.payment.tools.encryptalgorithm.SignUtils;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.mappers.CommonIncrementalChannelMapper;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.net.util.Base64;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.nio.charset.StandardCharsets;
import java.security.Key;
@Service
public class RetailRSvcServiceImpl implements RetailRSvcService {
@Resource
private ClientManager clientManager;
@Resource
private DeviceSupport deviceSupport;
@Resource
private CommonIncrementalChannelMapper commonIncrementalChannelMapper;
@Override
public JSONObject findMchInfoBySourceCode(JSONObject device, String sourceCode) {
String clientType = device.getString("client_type");
deviceSupport.findRegister(clientType);
JSONObject svcInfo = commonIncrementalChannelMapper.findIncreamentalChannelBySourceCode(sourceCode);
if (svcInfo == null || StringUtils.isEmpty(svcInfo.getString("channel_pub_key"))
|| StringUtils.isEmpty(svcInfo.getString("platform_pub_key")) || StringUtils.isEmpty("platform_pri_key")) {
throw new BadRequestException("this channel config is wrong");
}
RSvcMchBean svcMchBean = clientManager.findSvcMchByAccountId(device.getString("account_id"));
String pubKeyEncCredentialCode = SignUtils.encData(svcMchBean.getCredentialCode(), svcInfo.getString("channel_pub_key"));
String aesKeyStr = Base64.encodeBase64String(AESCrypt.randomKey().getEncoded());
Key key = AESCrypt.fromKeyString(Base64.decodeBase64(aesKeyStr));
String decCredentialCode = Base64.encodeBase64String(AESCrypt.encrypt(pubKeyEncCredentialCode.getBytes(StandardCharsets.UTF_8), key));
JSONObject result = (JSONObject) JSON.toJSON(svcMchBean);
result.put("sign_type", "RSA2");
result.put("enc_data", decCredentialCode);
result.put("nonce_str", aesKeyStr);
result.put("timestamp", System.currentTimeMillis());
result.put("sign", SignUtils.buildSign(result.toJSONString(), svcInfo.getString("platform_pri_key")));
return result;
}
}

@ -0,0 +1,26 @@
package au.com.royalpay.payment.manage.appclient.web;
import au.com.royalpay.payment.manage.appclient.core.RetailRSvcService;
import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.device.advise.AppClientController;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.annotation.Resource;
@AppClientController
@RequestMapping("/api/v1.0/retail/rsvc")
public class RetailRSvcController {
@Resource
private RetailRSvcService retailRSvcService;
@GetMapping(value = "/{source_code}/userinfo")
public JSONObject findUserInfoBySourceCode(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @PathVariable String source_code) {
return retailRSvcService.findMchInfoBySourceCode(device, source_code);
}
}

@ -99,4 +99,8 @@ public interface ClientAccountMapper {
@AutoSql(type = SqlType.SELECT) @AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid=1", excludeColumns = {"salt", "password_hash"}) @AdvanceSelect(addonWhereClause = "is_valid=1", excludeColumns = {"salt", "password_hash"})
List<JSONObject> findByWechatUnionId(@Param("wx_unionid")String unionId); List<JSONObject> findByWechatUnionId(@Param("wx_unionid")String unionId);
@AutoSql(type = SqlType.SELECT)
JSONObject findRSvcClientInfo(@Param("account_id")String accountId);
} }

@ -3,6 +3,7 @@ package au.com.royalpay.payment.manage.merchants.core;
import au.com.royalpay.payment.core.exceptions.EmailException; import au.com.royalpay.payment.core.exceptions.EmailException;
import au.com.royalpay.payment.manage.appclient.beans.AppClientBean; import au.com.royalpay.payment.manage.appclient.beans.AppClientBean;
import au.com.royalpay.payment.manage.appclient.beans.AppMerchantBean; import au.com.royalpay.payment.manage.appclient.beans.AppMerchantBean;
import au.com.royalpay.payment.manage.appclient.beans.RSvcMchBean;
import au.com.royalpay.payment.manage.merchants.beans.*; import au.com.royalpay.payment.manage.merchants.beans.*;
import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery; import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery;
import au.com.royalpay.payment.tools.merchants.beans.QRCodeConfig; import au.com.royalpay.payment.tools.merchants.beans.QRCodeConfig;
@ -356,6 +357,7 @@ public interface ClientManager {
/** /**
* *
*
* @param manager * @param manager
* @param clientMoniker * @param clientMoniker
* @param query * @param query
@ -496,6 +498,7 @@ public interface ClientManager {
/** /**
* / * /
*
* @param clientMoniker * @param clientMoniker
* @param incrementalService * @param incrementalService
*/ */
@ -503,6 +506,7 @@ public interface ClientManager {
/** /**
* / * /
*
* @param clientMoniker * @param clientMoniker
* @param incrementalService * @param incrementalService
*/ */
@ -510,6 +514,7 @@ public interface ClientManager {
/** /**
* *
*
* @param clientMoniker * @param clientMoniker
* @return * @return
*/ */
@ -517,4 +522,6 @@ public interface ClientManager {
JSONObject findByLookupCode(String code); JSONObject findByLookupCode(String code);
RSvcMchBean findSvcMchByAccountId(String accountId);
} }

@ -17,6 +17,7 @@ import au.com.royalpay.payment.core.PaymentChannelApi;
import au.com.royalpay.payment.core.exceptions.EmailException; import au.com.royalpay.payment.core.exceptions.EmailException;
import au.com.royalpay.payment.core.exceptions.InvalidShortIdException; import au.com.royalpay.payment.core.exceptions.InvalidShortIdException;
import au.com.royalpay.payment.core.mappers.SysClientMapper; import au.com.royalpay.payment.core.mappers.SysClientMapper;
import au.com.royalpay.payment.manage.appclient.beans.RSvcMchBean;
import au.com.royalpay.payment.tools.defines.IncrementalChannel; import au.com.royalpay.payment.tools.defines.IncrementalChannel;
import au.com.royalpay.payment.core.utils.OrderExpiryRuleResolver; import au.com.royalpay.payment.core.utils.OrderExpiryRuleResolver;
import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper; import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper;
@ -6143,10 +6144,29 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
JSONObject industryInfo = industryLookupMapper.findByLookupCode(code); JSONObject industryInfo = industryLookupMapper.findByLookupCode(code);
if (industryInfo == null) { if (industryInfo == null) {
return new JSONObject() {{ return new JSONObject() {{
put("lookup_code","未知行业"); put("lookup_code", "code");
put("lookup_value", "未知行业");
}}; }};
} }
return industryInfo; return industryInfo;
} }
@Override
public RSvcMchBean findSvcMchByAccountId(String accountId) {
JSONObject mchInfo = clientAccountMapper.findRSvcClientInfo(accountId);
if (mchInfo == null || mchInfo.isEmpty()) {
throw new BadRequestException("Client Not Exists!");
}
RSvcMchBean svcMchBean = new RSvcMchBean();
svcMchBean.setMerchantNumber(mchInfo.getString("username"));
svcMchBean.setMerchantName(mchInfo.getString("short_name"));
svcMchBean.setPartnerCode(mchInfo.getString("client_moniker"));
svcMchBean.setCredentialCode(mchInfo.getString("credential_code"));
svcMchBean.setPayHost(PlatformEnvironment.getEnv().mainHost());
svcMchBean.setLogo(mchInfo.getString("logo_url"));
svcMchBean.setIndustryCode(mchInfo.getString("industry"));
svcMchBean.setIndustryName(findByLookupCode(mchInfo.getString("industry")).getString("lookup_value"));
return svcMchBean;
}
} }

@ -41,4 +41,24 @@
ORDER BY a.create_time DESC ORDER BY a.create_time DESC
limit 1 limit 1
</select> </select>
<select id="findRSvcClientInfo" resultType="com.alibaba.fastjson.JSONObject">
SELECT
sa.username,
sc.client_id,
sc.client_moniker,
sc.credential_code,
sc.short_name,
sc.company_name,
ifnull(sc.logo_url,"NONE") logo_url,
sc.industry,
industry
FROM
sys_accounts sa,
sys_clients sc
WHERE
sa.account_id = #{account_id}
AND sc.client_id = sa.client_id
AND sc.is_valid = 1
AND sa.is_valid = 1
</select>
</mapper> </mapper>

@ -1,11 +1,23 @@
package au.com.royalpay.payment.manage.valid; package au.com.royalpay.payment.manage.valid;
import au.com.royalpay.payment.manage.analysis.beans.ato.CharacterUtils; import au.com.royalpay.payment.manage.analysis.beans.ato.CharacterUtils;
import au.com.royalpay.payment.manage.appclient.beans.RSvcMchBean;
import au.com.royalpay.payment.tools.codec.AESCrypt;
import au.com.royalpay.payment.tools.encryptalgorithm.SignUtils;
import com.alibaba.fastjson.JSONObject;
import com.github.stuxuhai.jpinyin.PinyinException; import com.github.stuxuhai.jpinyin.PinyinException;
import com.github.stuxuhai.jpinyin.PinyinFormat; import org.apache.commons.net.util.Base64;
import com.github.stuxuhai.jpinyin.PinyinHelper;
import org.junit.Test; import org.junit.Test;
import javax.crypto.BadPaddingException;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
/** /**
* Create by yixian at 2018-09-06 8:57 * Create by yixian at 2018-09-06 8:57
*/ */
@ -16,4 +28,38 @@ public class JPinYinTest {
System.out.println(CharacterUtils.convertFullWidthToHalfWidth(CharacterUtils.convertToPinYin(test))); System.out.println(CharacterUtils.convertFullWidthToHalfWidth(CharacterUtils.convertToPinYin(test)));
} }
@Test
public void testRSA() throws NoSuchPaddingException, NoSuchAlgorithmException, IllegalBlockSizeException, BadPaddingException, InvalidKeyException, InvalidKeySpecException {
String rsa1_pub = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlxNzoulC++qq9a37bvNe5hyoWhlybZxrOGXRunMK84zpTlCL1tDfiwVYuXipAH8z9U0GcU6noEeY1WqIDftK89zLiUtOEkIMZsIDkiuCbJip61ArhI/oRhb6DeyRk9oLo+5kO428ZOr/9NdVJUapMEqKSEvdMzDvnU5ruU7jBcUZpLkn108478OcNTptxAvy4+xaErij8BOuIooG6F2IfIRz9TfcYV7ycaD449l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ezV4Fp+LX/5ZRQwJXojPvZhxB8i0RdMiNmPQzjbTwKBgQCRB0sL+w6dSndwKdUag5CjllO9fIxMhNYVfGpBye0dqJyeJ8m7h6oOkDgYUt1LJzBLXqilRhZNxJtm9ZsBipNbgFQSC+Gi51ZBgkLx/IA8DT4Kd9BOgZmZBuf+Bt03uKPJaVRGsyQB8e+aJntwy6zJFTkDYxtDH0rpQNYfEjRwEQKBgA+p3IQVnakWh2HHHRkQ6UwN1iegQgYecwkJGspFJLF0k5Q6lDrIkDgXNPolY/KrTbJAA/399W0eTCX7fQJqrqdPZX4rOzUinERZ+PdU1TscEy2yPfwJV9nvghJ6yFKYbwp/enYAJ6SfrMxQDafKUFXJfVyJ1IxjwTXba1xUL2W7AoGAc6PzW66wEVYqvzfWzWr22tR0JS87b0h9eqyqHib5XATKmpKpJztMZvgj50fCGWxWcwW+QoEoxFZqRXWiFiS1Tax+UY7QDRF55JOOfZyl1+eerAQAq99sVg0QAom/9V4jZNfX3JZvIYI15opGSdI2hsRrtW7CBvYxsGz7mT3cLoE=";
RSvcMchBean aaa = new RSvcMchBean();
aaa.setMerchantNumber("taylor");
aaa.setIndustryName("其他服务行业");
aaa.setIndustryCode("331");
aaa.setCredentialCode("7dlXrdvhyuN73NDpZsGYftdIMuZms1Qc");
aaa.setLogo("https://file.royalpay.com.au/open/2017/07/24/1500898932409_7uFGyWIpk4IRTQyT3INk2Nk3KHedOG.png");
aaa.setPayHost("http://192.168.1.6:9008/");
aaa.setPartnerCode("PINE");
aaa.setMerchantName("TEST");
String pubKeyEncCredentialCode = SignUtils.encData(aaa.getCredentialCode(), rsa1_pub);
String aesKeyStr = Base64.encodeBase64String(AESCrypt.randomKey().getEncoded());
Key key = AESCrypt.fromKeyString(Base64.decodeBase64(aesKeyStr));
String decCredentialCode = Base64.encodeBase64String(AESCrypt.encrypt(pubKeyEncCredentialCode.getBytes(StandardCharsets.UTF_8), key));
JSONObject result = (JSONObject) JSONObject.toJSON(aaa);
result.put("sign_type", "RSA2");
result.put("enc_data", decCredentialCode);
result.put("nonce_str", aesKeyStr);
result.put("timestamp", System.currentTimeMillis());
result.put("sign", SignUtils.buildSign(result.toJSONString(), rsa2_pri));
System.err.println(result);
String signa = result.getString("sign");
result.remove("sign");
SignUtils.checkStringSign(result.toJSONString(), signa, rsa2_pub);
String aesData = new String(AESCrypt.decrypt(Base64.decodeBase64(result.getString("enc_data")), key), StandardCharsets.UTF_8);
System.err.println(SignUtils.decData(aesData, rsa1_pri));
}
} }

Loading…
Cancel
Save