这是一个创建于 1361 天前的主题,其中的信息可能已经有所发展或是发生改变。
求大神解答,万分感谢
PHP 源码:
$xmldata = '<?xml version="1.0" encoding="GBK"?>
<AIPG>
<INFO>
<TRX_CODE>310001</TRX_CODE>
<VERSION>05</VERSION>
<DATA_TYPE>2</DATA_TYPE>
<LEVEL>5</LEVEL>
<MERCHANT_ID>200604000012282</MERCHANT_ID>
<USER_NAME>20060400001228204</USER_NAME>
<USER_PASS>111111</USER_PASS>
<REQ_SN>200604000012282-1526894131128</REQ_SN>
</INFO>
<FAGRA>
<MERCHANT_ID>200604000012282</MERCHANT_ID>
<BANK_CODE>0104</BANK_CODE>
<ACCOUNT_TYPE>00</ACCOUNT_TYPE>
<ACCOUNT_NO>62284811119386045775</ACCOUNT_NO>
<ACCOUNT_NAME>小虎</ACCOUNT_NAME>
<ACCOUNT_PROP>0</ACCOUNT_PROP>
<ID_TYPE>0</ID_TYPE>
<ID>320382111111086514</ID>
<TEL>187621116887</TEL>
<REMARK>单笔实时身份验证-备注字段</REMARK>
</FAGRA>
</AIPG>';
openssl_pkcs12_read(file_get_contents('3.p12'), $certs, '111111');
$signature = '';
openssl_sign($xmldata, $signature, $certs['pkey']);
$sign = bin2hex($signature);
java 源码:
Signature sign = Signature.getInstance("SHA1withRSA");
sign.initSign(prikey);
sign.update(msg.getBytes(encoding));
byte signed[] = sign.sign();
byte sign_asc[] = new byte[signed.length * 2];
Hex2Ascii(signed.length, signed, sign_asc);
signedStr = new String(sign_asc);
4 条回复 • 2021-03-07 14:46:48 +08:00
|
|
1
unbeau 2021-03-06 23:04:14 +08:00
求大神帮助 java 的签名是正确的
|
|
|
3
fiypig 2021-03-07 11:15:15 +08:00 via iPhone
RSA 是不是要分段加解密啊?
|
|
|
4
unbeau 2021-03-07 14:46:48 +08:00
已经解决了,是加密的字符创多了个空格。。。
|