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