當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。