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


PHP Security::rijndael方法代码示例

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


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

示例1: _decode

 /**
  * Decodes and decrypts a single value.
  *
  * @param string $value The value to decode & decrypt.
  * @param string|false $encrypt The encryption cipher to use.
  * @return string Decoded value.
  */
 protected function _decode($value, $encrypt)
 {
     if (!$encrypt) {
         return $this->_explode($value);
     }
     $this->_checkCipher($encrypt);
     $prefix = 'Q2FrZQ==.';
     $value = base64_decode(substr($value, strlen($prefix)));
     if ($encrypt === 'rijndael') {
         $value = Security::rijndael($value, $this->_config['key'], 'decrypt');
     }
     if ($encrypt === 'aes') {
         $value = Security::decrypt($value, $this->_config['key']);
     }
     return $this->_explode($value);
 }
开发者ID:maitrepylos,项目名称:nazeweb,代码行数:23,代码来源:CookieComponent.php

示例2: _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->_config['encryption'] === 'rijndael') {
         $plain = Security::rijndael($value, $this->_config['key'], 'decrypt');
     }
     if ($this->_config['encryption'] === 'aes') {
         $plain = Security::decrypt($value, $this->_config['key']);
     }
     return $this->_explode($plain);
 }
开发者ID:ripzappa0924,项目名称:carte0.0.1,代码行数:22,代码来源:CookieComponent.php

示例3: testRijndaelInvalidKey

 /**
  * testRijndaelInvalidKey method
  *
  * @expectedException \InvalidArgumentException
  * @return void
  */
 public function testRijndaelInvalidKey()
 {
     $txt = 'The quick brown fox jumped over the lazy dog.';
     $key = 'too small';
     Security::rijndael($txt, $key, 'encrypt');
 }
开发者ID:Slayug,项目名称:castor,代码行数:12,代码来源:SecurityTest.php

示例4: _decode

 /**
  * Decodes and decrypts a single value.
  *
  * @param string $value The value to decode & decrypt.
  * @param string|false $encrypt The encryption cipher to use.
  * @param string|null $key Used as the security salt if specified.
  * @return string Decoded value.
  */
 protected function _decode($value, $encrypt, $key)
 {
     if (!$encrypt) {
         return $this->_explode($value);
     }
     $this->_checkCipher($encrypt);
     $prefix = 'Q2FrZQ==.';
     $value = base64_decode(substr($value, strlen($prefix)));
     if ($key === null) {
         $key = $this->_getCookieEncryptionKey();
     }
     if ($encrypt === 'rijndael') {
         $value = Security::rijndael($value, $key, 'decrypt');
     }
     if ($encrypt === 'aes') {
         $value = Security::decrypt($value, $key);
     }
     return $this->_explode($value);
 }
开发者ID:tgr0ss,项目名称:cakephp,代码行数:27,代码来源:CookieCryptTrait.php


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