小程序
小游戏
企业微信
微信支付
扫描小程序码分享
我用官方开发包按照官方文档开发的。不太明白{privateKey:私钥字符串」到底是传什么值?所以直接给的之前设置的apikey。
3 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
privateKey 是指商户API私钥证书,即从商户平台下载得到的文件名为 apiclient_key.pem 的文件地址,参阅:https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay3_0.shtml
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
java.lang.IllegalArgumentException: java.security.InvalidKeyException: Illegal key size
at com.wechat.pay.contrib.apache.httpclient.util.AesUtil.decryptToString(AesUtil.java:42)
at com.wechat.pay.contrib.apache.httpclient.auth.AutoUpdateCertificatesVerifier.deserializeToCerts(AutoUpdateCertificatesVerifier.java:138)
at com.wechat.pay.contrib.apache.httpclient.auth.AutoUpdateCertificatesVerifier.autoUpdateCert(AutoUpdateCertificatesVerifier.java:108)
at com.wechat.pay.contrib.apache.httpclient.auth.AutoUpdateCertificatesVerifier.<init>(AutoUpdateCertificatesVerifier.java:62)
at com.wechat.pay.contrib.apache.httpclient.auth.AutoUpdateCertificatesVerifier.<init>(AutoUpdateCertificatesVerifier.java:52)
at com.xpl.wx.util.HttpclientDemo.setup(HttpclientDemo.java:68)
at com.xpl.wx.util.HttpclientDemo.createOrder(HttpclientDemo.java:109)
at com.xpl.wx.util.HttpclientDemo.main(HttpclientDemo.java:130)
Caused by: java.security.InvalidKeyException: Illegal key size
at javax.crypto.Cipher.checkCryptoPerm(Cipher.java:1039)
at javax.crypto.Cipher.implInit(Cipher.java:805)
at javax.crypto.Cipher.chooseProvider(Cipher.java:864)
at javax.crypto.Cipher.init(Cipher.java:1396)
at javax.crypto.Cipher.init(Cipher.java:1327)
at com.wechat.pay.contrib.apache.httpclient.util.AesUtil.decryptToString(AesUtil.java:35)
... 7 more
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
privateKey 是指商户API私钥证书,即从商户平台下载得到的文件名为 apiclient_key.pem 的文件地址,参阅:https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay3_0.shtml
要不要去除文件首末行?换行符用不用替换掉?
-----BEGIN PRIVATE KEY-----
-----END PRIVATE KEY-----
现在报下面错误了
java.lang.IllegalArgumentException: java.security.InvalidKeyException: Illegal key size
at com.wechat.pay.contrib.apache.httpclient.util.AesUtil.decryptToString(AesUtil.java:42)
at com.wechat.pay.contrib.apache.httpclient.auth.AutoUpdateCertificatesVerifier.deserializeToCerts(AutoUpdateCertificatesVerifier.java:138)
at com.wechat.pay.contrib.apache.httpclient.auth.AutoUpdateCertificatesVerifier.autoUpdateCert(AutoUpdateCertificatesVerifier.java:108)
at com.wechat.pay.contrib.apache.httpclient.auth.AutoUpdateCertificatesVerifier.<init>(AutoUpdateCertificatesVerifier.java:62)
at com.wechat.pay.contrib.apache.httpclient.auth.AutoUpdateCertificatesVerifier.<init>(AutoUpdateCertificatesVerifier.java:52)
at com.xpl.wx.util.HttpclientDemo.setup(HttpclientDemo.java:68)
at com.xpl.wx.util.HttpclientDemo.createOrder(HttpclientDemo.java:109)
at com.xpl.wx.util.HttpclientDemo.main(HttpclientDemo.java:130)
Caused by: java.security.InvalidKeyException: Illegal key size
at javax.crypto.Cipher.checkCryptoPerm(Cipher.java:1039)
at javax.crypto.Cipher.implInit(Cipher.java:805)
at javax.crypto.Cipher.chooseProvider(Cipher.java:864)
at javax.crypto.Cipher.init(Cipher.java:1396)
at javax.crypto.Cipher.init(Cipher.java:1327)
at com.wechat.pay.contrib.apache.httpclient.util.AesUtil.decryptToString(AesUtil.java:35)
... 7 more