那位大神做过工行支付接口的?有问题请教

sun522198554 sun522198554 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
java的原来方法调用

public static byte[] sign(byte src[], int srcLen, byte privateKey[], char keyPass[])
throws NoSuchProviderException, InvalidKeyException, NoSuchAlgorithmException, SignatureException


<?php
require_once("Java.inc");

$icbc_Path= "";

$hello = new java("cn.com.infosec.icbc.ReturnValue");

$byteSrc= getBytes('test');

$fp = fopen($icbc_Path."156221A.key","rb");
fseek($fp,0,SEEK_END);
$filen_key=ftell($fp);
fseek($fp,0,SEEK_SET);
$contents = fread($fp,$filen_key);
fclose($fp);

$key = substr($contents,2);

$userKey= getBytes($key);


$strpass="12345678"; /*私钥保护口令*/

$java = new java('cn.com.infosec.icbc.ReturnValue');

$sin = $java->sign($byteSrc,count($byteSrc),$userKey,(array) $strpass);

var_dump($sin);

//var_dump($string);
/*字符串转换为字节数组*/
function getBytes($str){
$bytes=array();
for($i=0;$i<strlen($str);$i++){
$bytes[]=ord($str[$i]);
}
return $bytes;

}


$sin 是一个对象...请问$sin怎么转化为byte ?
...全文

相关推荐

评论 3
收藏 已收藏
分享
返回顶部
sun522198554
PHP 20,393 成员 19,654 内容