当前位置: 首页>>代码示例>>PHP>>正文


PHP rsaSign函数代码示例

本文整理汇总了PHP中rsaSign函数的典型用法代码示例。如果您正苦于以下问题:PHP rsaSign函数的具体用法?PHP rsaSign怎么用?PHP rsaSign使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了rsaSign函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: buildRequestMysign

 /**
  * 生成签名结果
  * @param $para_sort 已排序要签名的数组
  * return 签名结果字符串
  */
 function buildRequestMysign($para_sort)
 {
     //把数组所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串
     $prestr = createLinkstring($para_sort);
     $mysign = "";
     switch (strtoupper(trim($this->alipay_config['sign_type']))) {
         case "RSA":
             $mysign = rsaSign($prestr, $this->alipay_config['private_key_path']);
             break;
         default:
             $mysign = "";
     }
     return $mysign;
 }
开发者ID:wangjiang988,项目名称:ukshop,代码行数:19,代码来源:alipay_submit.class.php

示例2: getSign

 /**
  * 获取请求签名
  * @param $para_temp 请求的参数数组
  * @return 签名
  */
 public function getSign($para_temp)
 {
     //除去待签名参数数组中的空值和签名参数
     $para_filter = paraFilter($para_temp);
     //对待签名参数数组排序
     $para_sort = argSort($para_filter);
     //把数组所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串
     $prestr = createLinkstring($para_sort);
     $isSgin = false;
     switch (strtoupper(trim($this->alipay_config['sign_type']))) {
         case "RSA":
             $isSgin = rsaSign($prestr, trim($this->alipay_config['private_key_path']));
             break;
         default:
             $isSgin = false;
     }
     return $isSgin;
 }
开发者ID:jkzleond,项目名称:alhelp_api,代码行数:23,代码来源:AlipayController.class.php

示例3: buildRequestMysign

 function buildRequestMysign($para_sort)
 {
     $prestr = createLinkstring($para_sort);
     $mysign = "";
     switch (strtoupper(trim($this->alipay_config['sign_type']))) {
         case "MD5":
             $mysign = md5Sign($prestr, $this->alipay_config['key']);
             break;
         case "RSA":
             $mysign = rsaSign($prestr, $this->alipay_config['private_key_path']);
             break;
         case "0001":
             $mysign = rsaSign($prestr, $this->alipay_config['private_key_path']);
             break;
         default:
             $mysign = "";
     }
     return $mysign;
 }
开发者ID:keyu199314,项目名称:php,代码行数:19,代码来源:alipay_submit.class.php

示例4: alipayAction

 /**
  * 支付宝支付
  */
 public function alipayAction()
 {
     //支付宝提供的加密方式
     include_once __DIR__ . '/../../utils/alipay/lib/alipay_core.function.php';
     $babyId = $this->devices->getBabyIdByShoeId($this->userInfo['uid'], $this->_sanReq['shoe_id']);
     if (!$babyId) {
         $this->_showMsg(self::NON_SHOE, $this->di['flagmsg'][self::NON_SHOE]);
     }
     $rel = $this->_checkRelation($this->userInfo['uid'], $babyId['baby_id']);
     //角色名
     if (!empty($rel) && $rel['family_rolename'] != '') {
         $rolename = $rel['family_rolename'];
     } else {
         $rolename = '';
     }
     //获取套餐
     $renew = $this->renew->getRenew($serviceId, 1);
     if (!$renew) {
         $this->_showMsg(self::NON_PACKAGE, $this->di['flagmsg'][self::NON_PACKAGE]);
     }
     //配置
     $alipayConf = $this->di->get('sysconfig')['payment']['alipay'];
     //签名参数
     $params['partner'] = $alipayConf['partner'];
     $params['seller_id'] = $alipayConf['seller_id'];
     $params['out_trade_no'] = (string) Common::makeOrderSn();
     $params['subject'] = $renew['cr_name'];
     $params['body'] = $renew['cr_detail'];
     $params['total_fee'] = (string) number_format($renew['cr_real_price'], '2', '.', '');
     $params['notify_url'] = $this->di->get['sysconfig']['renewServer'] . $alipayConf['notify_url'];
     $params['service'] = 'mobile.securitypay.pay';
     $params['_input_charset'] = 'utf-8';
     $params['payment_type'] = '1';
     //生成续费订单,入库
     if (($res = $this->renew->renewUpdate($shoeId, $this->userInfo['uid'], $serviceId, $_SERVER['REQUEST_TIME'], 1, $params['out_trade_no'], 1, $params['total_fee'], $params['subject'], $renew['cr_period'], $renew['cr_coins'], $rolename, $babyId['baby_id'], $babyId['dev_imei'])) != self::SUCCESS) {
         $this->_showMsg($res, $this->di['flagmsg'][$res]);
     }
     $data = makeSignstring(argSort(paraFilter($params)));
     $params['sign'] = urlencode(rsaSign($data, $alipay_config['private_key_path']));
     $this->_returnResult(array('flag' => self::SUCCESS, 'data' => urlencode($data . '&sign="' . $params['sign'] . '"&sign_type="RSA"'), 'order_no' => $params['out_trade_no']));
 }
开发者ID:nicklos17,项目名称:appserver,代码行数:44,代码来源:RenewController.php

示例5: actionChargeOrder

 public function actionChargeOrder()
 {
     // 检查参数
     if (!isset($_REQUEST['uid']) || !isset($_REQUEST['pay_type']) || !isset($_REQUEST['token']) || !isset($_REQUEST['goods_id']) || !isset($_REQUEST['pay_type']) || !isset($_REQUEST['payment_type'])) {
         $this->_return('MSG_ERR_LESS_PARAM');
     }
     $uid = Yii::app()->request->getParam('uid');
     $token = trim(Yii::app()->request->getParam('token'));
     $pay_type = trim(Yii::app()->request->getParam('pay_type'));
     $app_id = trim(Yii::app()->request->getParam('app_id'));
     $payment_type = trim(Yii::app()->request->getParam('payment_type', 1));
     $goods_id = Yii::app()->request->getParam('goods_id');
     if (!Token::model()->verifyToken($uid, $token, $GLOBALS['__APPID'])) {
         $this->_return('MSG_ERR_TOKEN');
     }
     if (!User::model()->isSetPassword($uid)) {
         $this->_return('MSG_ERR_UNSET_PASSWORD');
     }
     $goods_info = Common::model()->getGoodsInfo($goods_id);
     if (!is_array($goods_info)) {
         $this->_return('MSG_ERR_FAIL_PARAM');
     }
     // 支付订单创建
     $out_trade_no = Pay::model()->createOrder($uid, $goods_info, $GLOBALS['__APPID'], $pay_type, $GLOBALS['__CHANNEL'], $GLOBALS['__PLATFORM']);
     if ($out_trade_no < 0) {
         $this->_return('MSG_ERR_UNKOWN');
     }
     // 记录Log
     Log::model()->_pay_log($uid, 'CREATE_ORDER', date('Y-m-d H:i:s'), $out_trade_no);
     $data['out_trade_no'] = $out_trade_no;
     $config_arr = Yii::app()->params['alipay_config'];
     //支付宝充值返回支付宝前段签名
     Yii::import('application.extensions.alipay.*');
     require_once 'lib/alipay_notify.class.php';
     $alipayNotify = new AlipayNotify($config_arr);
     $price = $goods_info['price'] / 100;
     $subject = $goods_info['name'];
     $body = $goods_info['name'] . ", 你值得拥有";
     $price = '"' . $price . '"';
     $subject = '"' . $subject . '"';
     $body = '"' . $body . '"';
     if ($app_id) {
         $app_id = '"' . $app_id . '"';
     }
     /*
     if($extern_token){
         $extern_token = '"'.$extern_token.'"';
     }
     */
     /*
     if($appenv){
         $appenv = '"'.$appenv.'"';
     }
     */
     if ($payment_type) {
         $payment_type = '"' . $payment_type . '"';
     }
     /*
     if($it_b_pay){
         $it_b_pay = '"'.$it_b_pay.'"';
     }
     */
     /*
     if($show_url){
         $show_url = '"'.urlencode($show_url).'"';
     }
     */
     $service = '"mobile.securitypay.pay"';
     $partner = '"' . Yii::app()->params['partner'] . '"';
     $charset = '"utf-8"';
     $notify_url = '"' . urlencode(Yii::app()->params['notifyUrl']) . '"';
     $out_trade_no = '"' . $out_trade_no . '"';
     $seller_id = '"' . Yii::app()->params['partner'] . '"';
     $sign_date = array('seller_id' => $seller_id, 'total_fee' => $price, 'service' => $service, 'partner' => $partner, '_input_charset' => $charset, 'notify_url' => $notify_url, 'out_trade_no' => $out_trade_no, 'subject' => $subject, 'app_id' => $app_id, 'payment_type' => $payment_type, 'body' => $body);
     $sign_date = paraFilter($sign_date);
     $sign_date = createLinkstring($sign_date);
     $private_key_url = '../extensions/alipay/' . $alipayNotify->alipay_config['private_key_path'];
     $data['sign'] = rsaSign($sign_date, $private_key_url);
     $data['url'] = $sign_date;
     $data['notifyUrl'] = Yii::app()->params['notifyUrl'];
     // 发送返回值
     $this->_return('MSG_SUCCESS', $data);
 }
开发者ID:hucongyang,项目名称:goddess,代码行数:83,代码来源:PayController.php

示例6: creatersa

function creatersa($info)
{
    $rsa = rsaSign($info, dirname(__FILE__) . '/mobilepay/alipaysdk/key/rsa_private_key.pem');
    return $rsa;
}
开发者ID:yonglinchen,项目名称:shopping,代码行数:5,代码来源:index.php

示例7: rsaSign

function rsaSign($data)
{
    $priKey = "-----BEGIN RSA PRIVATE KEY-----\n生成密钥时获取的私钥字符串,直接使用pem文件的完整字符串\n-----END RSA PRIVATE KEY-----";
    $res = openssl_get_privatekey($priKey);
    openssl_sign($data, $sign, $res);
    openssl_free_key($res);
    $sign = base64_encode($sign);
    $sign = urlencode($sign);
    return $sign;
}
// 支付宝合作者身份ID,以2088开头的16位纯数字
$partner = "%支付宝PartnerID%";
// 支付宝账号
$seller_id = '%支付宝账号,通常为邮箱地址%';
// 商品网址
$base_path = urlencode('http://www.dcloud.io/helloh5/');
// 异步通知地址
$notify_url = urlencode('http://demo.dcloud.net.cn/payment/alipay/notify.php');
// 订单标题
$subject = 'DCloud项目捐赠';
// 订单详情
$body = 'DCloud致力于打造HTML5最好的移动开发工具,包括终端的Runtime、云端的服务和IDE,同时提供各项配套的开发者服务。';
// 订单号,示例代码使用时间值作为唯一的订单ID号
$out_trade_no = date('YmdHis', time());
$parameter = array('service' => 'mobile.securitypay.pay', 'partner' => $partner, '_input_charset' => 'UTF-8', 'out_trade_no' => $out_trade_no, 'subject' => $subject, 'payment_type' => '1', 'seller_id' => $seller_id, 'total_fee' => $total, 'body' => $body, 'it_b_pay' => '1d', 'notify_url' => $notify_url, 'show_url' => $base_path);
//生成需要签名的订单
$orderInfo = createLinkstring($parameter);
//签名
$sign = rsaSign($orderInfo);
//生成订单
echo $orderInfo . '&sign="' . $sign . '"&sign_type="RSA"';
开发者ID:leidong666,项目名称:H5P.Server,代码行数:31,代码来源:index.php

示例8: getrsaSign

 function getrsaSign($prestr)
 {
     $isSgin = rsaSign($prestr, trim($this->alipay_config['private_key_path']));
     return $isSgin;
 }
开发者ID:hucongyang,项目名称:goddess,代码行数:5,代码来源:alipay_notify.class.php


注:本文中的rsaSign函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。