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 ?
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 ?
贴出结果
一大串对象 太多贴不下 先贴一小半object(java_InternalJava)#24 (7) {
["__client"]=>
object(java_Client)#2 (31) {
["RUNTIME"]=>
array(2) {
["NOTICE"]=>
string(104) "***USE echo java_inspect(jVal) OR print_r(java_values(jVal)) TO SEE THE CONTENTS OF THIS JAVA OBJECT!***"
["PARSER"]=>
string(6) "NATIVE"
}
["result"]=>
NULL
["exception"]=>
NULL
["parser"]=>
object(java_Parser)#3 (1) {
["parser"]=>
object(java_NativeParser)#4 (5) {
["parser"]=>
resource(3) of type (xml)
["handler"]=>
*RECURSION*
["level"]=>
int(0)
["event"]=>
bool(true)
["buf"]=>
string(58) "<O v="3" m="php.java.bridge.Request$PhpNull" p="O" n="T"/>"
}
}
["simpleArg"]=>
object(java_Arg)#15 (5) {
["client"]=>
*RECURSION*
["exception"]=>
NULL
["factory"]=>
object(java_SimpleFactory)#8 (1) {
["client"]=>
*RECURSION*
}
["val"]=>
int(3)
["signature"]=>
string(31) "cn.com.infosec.icbc.ReturnValue"
}