因为 网站 要加入一个用户接口 用户接口返回的信息中 最后有一个签名 签名的算法为MD5withRSA 算法key为 uapublic文件咨询一下PHP 能否实现?如何实现?有没有现成函数?咨询一下PHP调用Java 类,如果具体实现?以下的步骤是否正确?目前环境
因为 网站 要加入一个用户接口 用户接口返回的信息中 最后有一个签名 签名的算法为MD5withRSA 算法key为 uapublic文件咨询一下PHP 能否实现?如何实现?有没有现成函数?咨询一下PHP调用Java 类,如果具体实现?以下的步骤是否正确?目前环境网店系统ShopEx服务器操作系统:Linux+PHP+MySQL+Zend服务器管理软件:Plesk单店免费版修改 /etc/ i加入一下代码 是否正确?[Java] th = ./java/sign.jarjava.home = /sbin brary = /sbin/jvm brary = ./然后在 回传的 p加入以下代码 是否正确?rivate boolean checkAuthResult(HttpServletRequest aRequest){ String success = null; String userIdStr = null; String dateStr = null; success = (String) tParameter("Succeed"); userIdStr = (String) tParameter("UserId"); dateStr = (String) tParameter("Date"); long userId = 0l; long date = 0l; try{ userId = rseLong(userIdStr); date = rseLong(dateStr); }catch(Exception ex){ intln("userid or date error"); return false; } if ((success == null)||(success.equals("N")||success.equals("n"))){ intln("success error "); return false; } //验证时间戳 long currTime = rrentTimeMillis(); long diff = currTime - date; if ((diff > 60000)||(diff < -60000)){ intln("diff to large"); return false; } //验证签名 String jdoCfgFilePath = “./keyDir”; //公钥路径 String publicKeyFile = jdoCfgFilePath + "uapublic"; boolean valid = false; valid = lidateResponse(aRequest,publicKeyFile); if (valid == false){ intln("valid false"); return false; } return true; }以上的代码 应该是JAVA的 PHP调用JAVA类 应该具体怎么做?
展开
全部