当前位置: 首页 > news >正文

门户网站建设情况报告绍兴公司注册

门户网站建设情况报告,绍兴公司注册,苏州seo优化,wordpress页脚美化PHP 代码示例( Linux 版)解压后#xff0c;参考 phplinux/v3.4.0.1/文档/PHP版服务器端工具包(Linux版)软件使用手册.pdfDemo 运行1.安装对应版本的 PHP2.安装运行时环境(glibc 库等)3.修改 PHP 的配置文件 php.ini修改 php.ini#xff0c;使 php 允许加载扩展#xff0c;并…PHP 代码示例( Linux 版)¶解压后参考 phplinux/v3.4.0.1/文档/PHP版服务器端工具包(Linux版)软件使用手册.pdfDemo 运行1.安装对应版本的 PHP2.安装运行时环境(glibc 库等)3.修改 PHP 的配置文件 php.ini修改 php.ini使 php 允许加载扩展并将当前扩展添加到其扩展列表中enable_dl OnextensionlibSADKExtension.so.3.4.0.14.在 DemoRSA 目录下替换证书和 cer 文件pfx 为私钥文件请妥善保管不要泄露给他人cer 文件为颁发者公钥用来验证汇付公钥5.配置 cfcalog.conf cfca 日志文件6.通过命令行终端运行 Demo 文件php huifuCFCALinuxDemo.phpMsg PKCS7-attached Sign为使用 pfx 证书加签PKCS7-attached-Verify为验证汇付的签名cfca_verifyCertificate为验证证书链合法性cfca_getCertificateInfo为获取证书信息(非必要)phpclass HuifuCFCA{private $apiUrl https://eacloud.testpnr.com/api/publicRequests; //企账通商户交易接口,此处使用的是联调环境地址private $strSignAlg RSA; //RSA证书类型private $strPfxPassword 888888; //导出时设置的密码private $strHashAlg SHA-256; //加签算法private $strPfxFilePath ./RSA/AS0381.pfx; //汇付下发的证书此处换成商户自己的证书 .pfx 格式 加签使用private $strTrustedCACertFilePath ./RSA/CFCA_ACS_TEST_OCA31.cer|./RSA/CFCA_ACS_TEST_CA.cer; //汇付下发的.cer证书 需要一对证书 解签使用private $strLogCofigFilePath ./cfcalog.conf; //CFCA log 目录public function __construct(){$this-getCFCAInitialize(); //CFCA工具初始化}/*** CFCA工具初始化*/private function getCFCAInitialize(){$nResult cfca_initialize($this-strLogCofigFilePath);if (0 ! $nResult) {//记录logecho new Exception(\n cfca_Initialize error:.$nResult.\n);}}/*** 调用接口 此处是企账通的接口请求** return string*/public function apiRequest(){//请求参数依据商户自己的参数为准$requestParam[version] 10;$requestParam[cmd_id] Q01; //交易订单查询$requestParam[mer_cust_id] 6666000000002619;$requestParam[user_cust_id] 6666000000054387;$requestParam[order_date] 20180918;$requestParam[order_id] 201809189000001;$requestParam[trans_type] 01;$requestParam[mer_priv] ;//加签$strSignSourceData json_encode($requestParam);$cfcaSign $this-CFCASignature($strSignSourceData);//接口请求参数$param [requestData [cmd_id $requestParam[cmd_id],mer_cust_id $requestParam[mer_cust_id],version $requestParam[version],check_value $cfcaSign,],headers [Content-type application/x-www-form-urlencoded;charsetUTF-8]];$requestData $this-requestData($param);$checkValue json_decode($requestData[body],1)[check_value];//验证接口返回的签名数据$sourceData $this-getCFCASignSourceData($checkValue);$SignCertContent !empty($sourceData[strMsgP7AttachedSignCertContent]) ? $sourceData[strMsgP7AttachedSignCertContent] : ;//验证返回数据的CFCA证书有效性$verifyCertificat $this-verifyCertificat($SignCertContent);$signSourceData ;if(!empty($sourceData[strMsgP7AttachedSource]) $verifyCertificat){ //校验证书有效性$signSourceData $sourceData[strMsgP7AttachedSource];}return $signSourceData;}/*** CFCA 加签方法** param $strSignSourceData base64 encode 加签原串* return string base64 encode 加签串*/private function CFCASignature($strSignSourceData){$strMsgPKCS7AttachedSignature ;//加签生成串 ,输出变量无需传值try{//调用加签方法$nResult cfca_signData_PKCS7Attached($this-strSignAlg, $strSignSourceData,$this-strPfxFilePath, $this-strPfxPassword, $this-strHashAlg,$strMsgPKCS7AttachedSignature);//加签方法异常判断及记录if (0 ! $nResult) {//记录logecho new Exception(\n cfca_signData_PKCS7Attached error:.$nResult.\n);}}catch (Exception $e){throw new Exception(\n cfca_verifyCertificate error:.$e.\n);}return base64_encode($strMsgPKCS7AttachedSignature);}/*** CFCA 验证签名数据** param $signature* return array*/private function getCFCASignSourceData($signature){$strMsgP7AttachedSignCertContent ; //PKCS#7 中的签名证书 输出变量无需传值$strMsgP7AttachedSource ; //签名原文字符串 输出变量无需传值try{//调用验证签名数据方法$nResult cfca_verifyDataSignature_PKCS7Attached($this-strSignAlg, base64_decode($signature),$strMsgP7AttachedSignCertContent,$strMsgP7AttachedSource);//验证签名方法异常判断及记录if (0 ! $nResult) {//记录logecho new Exception(cfca_verifyDataSignature error:.$nResult);}}catch (Exception $e){//记录logthrow new Exception(cfca_verifyDataSignature_PKCS7Attached error:.$e);}return array(strMsgP7AttachedSource $strMsgP7AttachedSource,strMsgP7AttachedSignCertContent $strMsgP7AttachedSignCertContent,);}/*** CFCA 证书有效性验证** param $strMsgP7AttachedSignCertContent PKCS#7 中的签名证书 base64* return int*/private function verifyCertificat($strMsgP7AttachedSignCertContent ){$nCertVerifyFlag 4; //验证证书链完整性$strTrustedCACertFilePath $this-strTrustedCACertFilePath;$isVerify false;try{//调用验证方法$nResult cfca_verifyCertificate($strMsgP7AttachedSignCertContent, $nCertVerifyFlag, $strTrustedCACertFilePath,);if (0 $nResult) { // 0 为验证通过 其他验证失败$isVerify true;}else{//记录logecho new Exception(cfca_verifyCertificate error:.$nResult);}}catch (Exception $e){//记录logthrow new Exception(cfca_verifyCertificate error:.$e);}return $isVerify;}/*** 请求接口返回数据* param $param* return array*/private function requestData($param){try{// 请求接口所以参数初始化$data [url $this-apiUrl, // 接口 urlrequestData $param[requestData], // 请求接口参数headers $param[headers]];$res $this-httpPostRequest($data[url],$data[headers],$data[requestData]);} catch (\Exception $e) {//记录logthrow new Exception(api requestData error :.$e);}return [status $res[info][http_code],body $res[body]];}/*** curl post 请求方法** param string $url* param array $header* param array $requestData* return array*/private function httpPostRequest($url ,$header array(),$requestData array()){$curl curl_init();curl_setopt ( $curl, CURLOPT_HTTPHEADER,$header);curl_setopt($curl, CURLOPT_URL, $url);curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);curl_setopt($curl, CURLOPT_POST, true);curl_setopt($curl, CURLOPT_POSTFIELDS,http_build_query($requestData));$res curl_exec($curl);$info curl_getinfo($curl);$error curl_error($curl);curl_close($curl);return [body $res,info $info,error $error,];}/***CFCA工具结束*/public function __destruct(){cfca_uninitialize();}}//调用$demoObj new HuifuCFCA();$data $demoObj-apiRequest();print_r();print_r($data);?
http://www.yutouwan.com/news/147308/

相关文章:

  • 专业型网站网站辽宁住房和城乡建设部网站
  • 湖北专业网站建设公司wordpress大学最新模板下载
  • 网站建设申报方案济南做网站互联网公司有哪些
  • 嘉定网站公司做跨境的网站有哪些
  • 如何去掉Wordpress访问网站网站建设单子
  • asp.net 网站的头部和底部怎么来做 include如何通过做网站和公众号盈利
  • 德宏企业网站建设公司网站建设感想
  • 广州网站建设c2c网站审核备案 几天
  • 洞口网站开发公司推荐网站一元空间有哪些呀
  • 免费ftp网站滴滴网站建设流程
  • 汽车网站制作模板做印刷网站公司
  • 中国建设银行互联网网站首页石河子网站建设
  • 网站维保方法企业 网站 程序
  • 网站平台建设什么意思3d建模平台
  • 大学生网站建设小结wordpress能做论坛吗
  • 网站建设 东方网景vue消息推送和系统通知
  • 网站建设自学网站开发业务流程图
  • 企业网站seo优帮云做网站前端用什么
  • 擦边球做网站挣钱做海外视频的网站有哪些
  • 网站建设服务属于信息技术服务吗微信管理平台登录
  • 大型百度云网站建设关于做电影的网站设计
  • 企业网站找谁做摄影网站功能设计
  • 网站反链暴增怎么回事湄洲岛网站建设
  • 兰山区网站建设推广界面设计流程
  • 呢图网站场建设封面贵州seo和网络推广
  • 百度免费网站如何建设北京互联网平台
  • 网站建设类公桐城做网站的公司
  • 怎么建立网站 个人热点全国工商登记网
  • 网站开发是什么职业网络工程设计的概念
  • 网站建设导航栏变化wordpress adminlte