當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。