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


PHP Security::decrypt方法代码示例

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


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

示例1: index

 public function index()
 {
     var_dump(Security::hash('sha256', 'test'));
     $c = Security::encrypt('blowfish', 'test', 'cbc');
     $e = Security::decrypt($c['ciphertext'], 'blowfish', 'cbc', $c['key'], $c['iv_size']);
     var_dump('test : ' . $c['ciphertext']);
     var_dump('test : ' . $e);
 }
开发者ID:kranack,项目名称:frmwrk,代码行数:8,代码来源:SecurityController.php

示例2: decrypt

 public static function decrypt($string)
 {
     $sections = explode('|', $string);
     if (count($sections) == 2) {
         $output = trim(Security::decrypt(MCRYPT_RIJNDAEL_256, self::$encryptionKey, $sections[0], MCRYPT_MODE_CBC, base64_decode($sections[1])));
         list($hash, $data) = explode('|', $output, 2);
         if ($hash && $data) {
             $hashed = Security::hmac('sha256', $data, self::$validationKey);
             if ($hash == $hashed) {
                 $data = unserialize($data);
                 return new AuthenticationTicket($data[0], $data[1], $data[2]);
             }
         }
     }
     return false;
 }
开发者ID:joeldavuk,项目名称:framework,代码行数:16,代码来源:Authentication.php

示例3: afterFind

 public function afterFind($results, $primary = false)
 {
     App::uses('Security', 'Utility');
     foreach ($this->encryptedFields as $fieldName) {
         if (!isset($results[$this->alias])) {
             foreach ($results as $i => $data) {
                 if (!empty($data[$this->alias][$fieldName])) {
                     $results[$i][$this->alias][$fieldName] = Security::decrypt($data[$this->alias][$fieldName], Configure::read('Security.key'));
                 }
             }
         }
         if (!empty($results[$this->alias][$fieldName])) {
             $results[$this->alias][$fieldName] = Security::decrypt($results[$this->alias][$fieldName], Configure::read('Security.key'));
         }
     }
     return $results;
 }
开发者ID:nskolaris,项目名称:bank-mobile-app,代码行数:17,代码来源:Participante.php

示例4: decryptURL

 public static function decryptURL($input, $key)
 {
     return Security::decrypt(base64_decode(urldecode($input)), $key);
 }
开发者ID:azizjonm,项目名称:OpenCTF-1,代码行数:4,代码来源:security.class.php

示例5: define

	Рефакторинг и комментарии от AntifreeZZe
*/
//Если не определить, connect.php кинет ошибку
define('INCLUDE_CHECK', true);
//А вот и сам connect.php
include "connect.php";
include_once "ecodes.php";
include_once "loger.php";
include_once "security.php";
//Ставим тип ответа и кодировку (UTF-8)
header('Content-Type : text/plain; charset=utf-8');
//parse_str($_SERVER['QUERY_STRING'],$_POST);
//Получаем данные и расшифровываем
$x = rawurldecode($_POST['action']);
//@$x = str_replace(" ", "+", $x);
$yd = Security::decrypt($x, $key2);
#echo $yd;
//Парсим расшифрованное
$json = json_decode($yd, true);
$action = $json['action'];
$client = $json['client'];
$login = $json['login'];
$postPass = $json['pass'];
$launchermd5 = $json['md5'];
//@list($action, $client, $login, $postPass, $launchermd5) = explode(':', $yd);
//Проверяем соответствие лаунчера
if ($checklauncher) {
    /*if($launchermd5 != null)
    	    {
    		    if($launchermd5 == @$md5launcherexe)
    		    {
开发者ID:unn4m3d,项目名称:xmml,代码行数:31,代码来源:launcher.php

示例6: testDecryptInvalidData

 /**
  * Test that empty data cause errors
  *
  * @expectedException CakeException
  * @expectedExceptionMessage The data to decrypt cannot be empty.
  * @return void
  */
 public function testDecryptInvalidData()
 {
     $txt = '';
     $key = 'This is a key that is long enough to be ok.';
     Security::decrypt($txt, $key);
 }
开发者ID:agashish,项目名称:test_new,代码行数:13,代码来源:SecurityTest.php

示例7: unserialize

    $smtp_log = "smtp_local_settings.log";
} else {
    $smtp_log = "smtp_online_settings.log";
}
DEFINE('TLW_WEBMASTER', "webmaster@tlwsolicitors.co.uk");
if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/admin/inc/' . $settings_log)) {
    $settings_raw = file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/admin/inc/' . $settings_log);
    if (!empty($settings_raw)) {
        $settings = unserialize($settings_raw);
        //Global Email address settings
        DEFINE('TLW_SOURCE_EMAIL', $settings['src_email']);
        DEFINE('TLW_SOURCE_NAME', $settings['src_name']);
        DEFINE('TLW_REPLY_EMAIL', $settings['reply_email']);
        DEFINE('TLW_REPLY_NAME', $settings['reply_name']);
        DEFINE('TLW_IMPORT_EMAIL', $settings['import_email']);
        DEFINE('TLW_IT_EMAIL', $settings['it_admin_email']);
        DEFINE('TLW_IT_NAME', $settings['it_admin_name']);
    }
}
if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/admin/inc/' . $smtp_log)) {
    $secure_pass = new Security();
    $smtp_settings_raw = file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/admin/inc/' . $smtp_log);
    if (!empty($smtp_settings_raw)) {
        $smtp_settings = unserialize($smtp_settings_raw);
        //Global SMTP settings
        DEFINE('TLW_SMTP_HOST', $smtp_settings['smtp_host']);
        DEFINE('TLW_SMTP_PORT', $smtp_settings['smtp_port']);
        DEFINE('TLW_SMTP_USER', $smtp_settings['smtp_user']);
        DEFINE('TLW_SMTP_PWD', $secure_pass->decrypt($smtp_settings['smtp_pwd']));
    }
}
开发者ID:kevwaddell,项目名称:tlw-echosign,代码行数:31,代码来源:global-settings.php

示例8: setlocale

<?php

include 'security.php';
include 'config.php';
setlocale(LC_MONETARY, 'de_DE');
// read input and decode it
$myRentalId = Security::decrypt($_GET["id"], $key);
$myRentalIdExploded = explode("_", $myRentalId);
$dateExploded = explode("-", $myRentalIdExploded[0]);
$year = $dateExploded[0];
$month = $dateExploded[1];
$day = $dateExploded[2];
$dayId = $myRentalIdExploded[1];
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "{$backend}/rest/rental/{$year}/{$month}/{$day}/{$dayId}");
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Accept: application/json', 'Content-Type: application/json', 'username:' . $username, 'password:' . $password));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($curl);
$code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
// log
file_put_contents("myrental.log", date("Y-m-d H:i:s", time()) . " " . "{$year}-{$month}-{$day} {$dayId} {$code}\n", FILE_APPEND);
curl_close($curl);
?>

    <html>
    <head>
        <title>Bootsvermietung EPPEL - meine Bootsfahrt</title>
        <link rel="stylesheet" href="boatpos.css">
        <link href="favicon.ico" rel="shortcut icon" type="image/x-icon"/>
开发者ID:andi-git,项目名称:boatpos,代码行数:31,代码来源:index.php

示例9: _decode

 /**
  * Decodes and decrypts a single value.
  *
  * @param string $value The value to decode & decrypt.
  * @return string Decoded value.
  */
 protected function _decode($value)
 {
     $prefix = 'Q2FrZQ==.';
     $pos = strpos($value, $prefix);
     if ($pos === false) {
         return $this->_explode($value);
     }
     $value = base64_decode(substr($value, strlen($prefix)));
     if ($this->_type === 'rijndael') {
         $plain = Security::rijndael($value, $this->key, 'decrypt');
     }
     if ($this->_type === 'cipher') {
         $plain = Security::cipher($value, $this->key);
     }
     if ($this->_type === 'aes') {
         $plain = Security::decrypt($value, $this->key);
     }
     return $this->_explode($plain);
 }
开发者ID:4Queen,项目名称:php-buildpack,代码行数:25,代码来源:CookieComponent.php

示例10: before_action

 function before_action()
 {
     if ($this->sessionType == 'cookie' || $this->sessionIDType == 'cookie') {
         if (empty($this->controller->Cookie)) {
             e('Cookie-based sessions require the Cookie component to be loaded');
             die;
         }
     }
     if ($this->sessionType == 'database') {
         throw new Exception('Database-persisted sessions are not implemented yet');
         if (empty($this->controller->Db)) {
             e('Database-persisted sessions require the Db component to be loaded');
             die;
         }
     } else {
         if ($this->sessionType == 'file') {
             if (empty($this->controller->File)) {
                 e('File-persisted sessions require the File component to be loaded');
                 die;
             }
         }
     }
     $this->clear_expired_sessions();
     // Load the session if available
     $this->inSession = false;
     // get the session id
     $this->sessionID = null;
     if ($this->sessionType == 'cookie' || $this->sessionIDType == 'cookie') {
         // Load from the cookie:
         if (!empty($this->controller->Cookie->data[$this->sessionCookieName])) {
             $this->sessionID = $this->controller->Cookie->data[$this->sessionCookieName]['session_id'];
         }
     } else {
         if ($this->sessionIDType == 'url') {
             $this->sessionID = $this->controller->data['session_id'];
             // the session ID is encrypted, so decrypt it before use
             $this->sessionID = Security::decrypt($this->sessionID);
         }
     }
     if (empty($this->sessionID)) {
         return;
     }
     // get the session
     if ($this->sessionType == 'file') {
         $sessionFilename = $this->__get_session_filename();
         if ($this->controller->File->exists($sessionFilename)) {
             $this->data = $this->controller->File->read_object($sessionFilename);
             if (empty($this->data)) {
                 $this->data = array();
             }
             $this->inSession = true;
         }
     } else {
         if ($this->sessionType == 'database') {
         } else {
             if ($this->sessionType == 'cookie') {
                 if (!empty($this->controller->Cookie->data[$this->sessionCookieName]) && !empty($this->controller->Cookie->data[$this->sessionCookieName]['session_data'])) {
                     $this->data = $this->controller->Cookie->data[$this->sessionCookieName]['session_data'];
                     if (empty($this->data)) {
                         $this->data = array();
                     }
                     $this->inSession = true;
                 }
             }
         }
     }
 }
开发者ID:slab-php,项目名称:slab,代码行数:67,代码来源:session.php

示例11: Security

 function __decrypt_data($arr = null)
 {
     $security = new Security($this->config);
     if (empty($arr)) {
         $arr =& $this->data;
     }
     if (empty($arr)) {
         return null;
     }
     foreach ($arr as $k => $v) {
         if (!is_array($v)) {
             $arr[$k] = $security->decrypt($v);
         } else {
             $arr[$k] = $this->__decrypt_data($v);
         }
     }
     return $arr;
 }
开发者ID:slab-php,项目名称:slab,代码行数:18,代码来源:cookie.php

示例12:

<?php

include 'security.php';
$value = "example";
$key = "1234567891234567";
//16 Character Key
echo Security::encrypt($value, $key);
echo Security::decrypt(Security::encrypt($value, $key), $key);
开发者ID:farhad-m,项目名称:PHP-Java-AES-Encrypt,代码行数:8,代码来源:example.php

示例13: get

 /**
  * Descriptograda e retorna uma sessão específica do usuário
  * @param	string	$name		nome da sessão a ser retornada
  * @throws	TriladoException	disparado se a configuração 'salt' não for definida ou o valor for vazio
  * @return	mixed				retorna o valor sessão descriptografado
  */
 public static function get($name)
 {
     if (Config::get('salt') == null) {
         throw new ConfigNotFoundException("A configuração 'salt' não pode ter o valor nulo");
     }
     self::start();
     if (isset($_SESSION['Trilado.Core.Session'][$name])) {
         return Security::decrypt($_SESSION['Trilado.Core.Session'][$name], self::key());
     }
 }
开发者ID:nylmarcos,项目名称:estagio,代码行数:16,代码来源:Session.php

示例14: function

<?php

echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'nombre', ['attribute' => 'correo', 'value' => function ($searchModel) {
    return Security::decrypt($searchModel->email);
}], 'comentario:ntext', ['attribute' => 'noticia_id', 'format' => 'raw', 'value' => function ($searchModel) {
    return Html::a($searchModel->noticia->titulo, "@web/articulo/" . $searchModel->noticia->seo_slug);
}], ['attribute' => 'estado', 'format' => 'raw', 'value' => function ($searchModel) {
    if ($searchModel->estado === 0) {
        return "<span class='glyphicon glyphicon-remove'></span>";
    } else {
        return "<span class='glyphicon glyphicon-ok'></span>";
    }
}], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update} {delete} {aprobar}', 'buttons' => ['aprobar' => function ($url, $model) {
    if ($model->estado === 0) {
        return Html::a('<span class="glyphicon glyphicon-thumbs-up"></span>', $url, ['title' => Yii::t('app', 'Aprobar comentario')]);
    }
}, 'update' => function ($url, $model) {
    return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, ['title' => Yii::t('app', 'Actualizar')]);
}], 'urlCreator' => function ($action, $model, $key, $index) {
    if ($action === 'aprobar') {
        return yii\helpers\Url::to(['comentario/aprobar', 'id' => $key]);
    } elseif ($action == 'update') {
        return yii\helpers\Url::to(['comentario/update/', 'id' => $key]);
    } elseif ($action === 'delete') {
        return yii\helpers\Url::to(['comentario/delete/', 'id' => $key]);
    }
}]]]);
开发者ID:nando9,项目名称:yii2capa8,代码行数:27,代码来源:gridviewcomentario.php

示例15: isValid

 public static function isValid($response, $username = "", $salt = "", $panel = true)
 {
     if ($panel) {
         $_username = "_panel_username";
         $_name = "_panel_name";
         $_ninjaPower = "_panel_ninja_power";
         $_hash = "_panel_hash";
         $_user_ref = "_panel_user_ref";
     } else {
         $_username = "_openctf_username";
         $_name = "_openctf_name";
         $_ninjaPower = "_openctf_ninja_power";
         $_hash = "_openctf_hash";
         $_user_ref = "_openctf_user_ref";
     }
     $response->cookie($_user_ref, $username, time() + 86400 * 30, "/", Session::getDomain(), Session::isSecure());
     if ($username == "" && $salt == "") {
         if (isset($_COOKIE[$_username]) && isset($_COOKIE[$_name]) && isset($_COOKIE[$_ninjaPower]) && isset($_COOKIE[$_hash])) {
             return true;
         }
     }
     if (isset($_COOKIE[$_username]) && isset($_COOKIE[$_name]) && isset($_COOKIE[$_ninjaPower]) && isset($_COOKIE[$_hash])) {
         if ($username == $_COOKIE[$_username]) {
             $time = Security::decrypt($_COOKIE[$_ninjaPower], $salt);
             $hash = hash("sha256", $salt . $username . $time);
             if ($hash == $_COOKIE[$_hash]) {
                 return true;
             } else {
                 return false;
             }
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
开发者ID:azizjonm,项目名称:OpenCTF-1,代码行数:37,代码来源:Session.php


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