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


PHP Encryption::enc方法代码示例

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


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

示例1: generate

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

示例2: setup

 /**
  * For newly created sessions initial data is required,
  * such as client information, private salt and such.
  */
 private function setup()
 {
     // No need?
     if (self::g('client') != "") {
         return;
     }
     // Setup!
     self::s('client', Encryption::enc($this->client, Site::getKey('session')));
     self::s('created', date("Y-m-d H:i:s"));
     // Every Session use a unique key; see getInternalKey().
     //
     $this->buildInternalKey();
     $this->set("end", "now.");
 }
开发者ID:rszabo,项目名称:egalite,代码行数:18,代码来源:Session.php

示例3: RuntimeException

    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);
    // Username and passphrase successfully read.
    $username = $cred_obj[0];
    $passphrase = $cred_obj[1];
    // Set asymmetric key to be used in future communication
    $session = Session::getInstance();
    $session->set(Session::TRANSPORT_KEY, Encryption::genGarbage(Session::KEYSIZE));
    // Clear login key
    $session->set(Captcha::KEY_LOGIN, null);
    // Let's say that everything went well and Citizen $username was loaded successfully.
    $res = array("id" => 123, "username" => $username, Session::STORAGE_KEY => base64_encode(Session::getStorageKey()), Session::TRANSPORT_KEY => base64_encode($session->get(Session::TRANSPORT_KEY)));
    // This is where you normally pass $res (Api::handleRequest()) to whatever renderer is available.
    /* Output */
    $output = json_encode(array("result" => $res));
    die(Encryption::enc($output, $key));
} catch (Exception $e) {
    $output = json_encode(array("error" => array("code" => 1, "message" => $e->getMessage())));
    trigger_error($e->getMessage());
    die(Encryption::enc($output, $key));
}
开发者ID:rszabo,项目名称:egalite,代码行数:31,代码来源:login.php


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