本文整理汇总了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();
}
示例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')) : '';
}
示例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);