使用公钥证书加签时,按照文档提供的方法报错,没法接入,想请问一下应该用什么方式接入?是使用java的
接入代码如下:
// 目标蚂蚁金服服务端地址,线上环境为 openchannel.alipay.com
String serverHost = "openchannel.alipay.com";
// 数据签名方式,请与应用设置的默认签名方式保持一致
String signType = "RSA2";
// 支付宝公钥
String alipayPublicKey = AlipaySignature.getAlipayPublicKey(ALIPAY_CERT_PATH);
// 获取client对象,一个appId对应一个实例
AlipayMsgClient client = AlipayMsgClient.getInstance(APP_ID);
client.setConnector(serverHost);
client.setSecurityConfig(signType, APP_PRIVATE_KEY, alipayPublicKey);
client.setBizThreadPoolCoreSize(16);
client.setBizThreadPoolMaxSize(32);
client.setMessageHandler(new MsgHandler() {
public void onMessage(String msgApi, String msgId, String bizContent) {
System.out.println("receive message. msgApi:" + msgApi + " msgId:" + msgId + " bizContent:" + bizContent);
}
});
client.connect();
返回异常如下:
2019-10-14 20:42:39.558 - sdk.biz.err java.lang.RuntimeException: register response code means fail! {"msg":"sigsecretkeynotconfigured","code":"112031005"}
java.lang.RuntimeException: register response code means fail! {"msg":"sigsecretkeynotconfigured","code":"112031005"}
at com.alipay.api.msg.AlipayMsgClient.parseRegResp(AlipayMsgClient.java:439)
at com.alipay.api.msg.AlipayMsgClient.register(AlipayMsgClient.java:387)
at com.alipay.api.msg.AlipayMsgClient.doConnect(AlipayMsgClient.java:141)
at com.alipay.api.msg.AlipayMsgClient.access$300(AlipayMsgClient.java:39)
at com.alipay.api.msg.AlipayMsgClient$2.run(AlipayMsgClient.java:109)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。