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


PHP Encryption::dec方法代码示例

本文整理汇总了PHP中Encryption::dec方法的典型用法代码示例。如果您正苦于以下问题:PHP Encryption::dec方法的具体用法?PHP Encryption::dec怎么用?PHP Encryption::dec使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Encryption的用法示例。


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

示例1: match

 public static function match($storage_key)
 {
     $dec = Encryption::dec(base64_decode($storage_key), self::getSalt());
     return $dec === self::getData();
 }
开发者ID:rszabo,项目名称:egalite,代码行数:5,代码来源:StorageKey.php

示例2: getStoredClient

 /**
  * Return the client which is registered in our session.
  * The client id is encrypted in the session file,
  * and has a totally different encryption in the
  * database.
  */
 public function getStoredClient()
 {
     $c = self::g('client');
     return $c ? Encryption::dec($c, Site::getKey('session')) : '';
 }
开发者ID:rszabo,项目名称:egalite,代码行数:11,代码来源:Session.php

示例3: file_get_contents

 *
 * This is a simple example of how to respond to a login request.
 *
 */
$auto_login = false;
require "../../include/iq.php";
try {
    /* Validate body */
    $body = file_get_contents('php://input');
    if (!$body && !isset($_REQUEST['_'])) {
        throw new RuntimeException("404");
    }
    /* Input is encrypted with the hashed captcha! */
    $key = base64_encode(Session::getCurrent()->get(Captcha::KEY_LOGIN));
    // Attempt to decrypt
    if (!($data = Encryption::dec($_REQUEST["_"], $key))) {
        throw new RuntimeException("Unable to decrypt received data, please check your local key or verification code.");
    }
    // Check JSON
    if (!($jdata = json_decode($data, true))) {
        throw new RuntimeException("Unable to parse input.");
    }
    if (empty($jdata["credentials"])) {
        throw new RuntimeException("Received credentials are missing.");
    }
    // Read credentials
    $cred_obj = explode(" ", base64_decode($jdata['credentials']));
    if (count($cred_obj) < 2) {
        throw new RuntimeException("Received credentials are malformed.");
    }
    // This is where you normally handle the call, i.e.. $res = Api::handleRequest($jdata);
开发者ID:rszabo,项目名称:egalite,代码行数:31,代码来源:login.php


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