本文整理汇总了PHP中Crypt_Base::decrypt方法的典型用法代码示例。如果您正苦于以下问题:PHP Crypt_Base::decrypt方法的具体用法?PHP Crypt_Base::decrypt怎么用?PHP Crypt_Base::decrypt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Crypt_Base
的用法示例。
在下文中一共展示了Crypt_Base::decrypt方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* {@inheritDoc}
*
* @throws \UnexpectedValueException
*/
public function render(AttributeEvent $event)
{
$cipherText = $event->getValue();
// The Amazon SDK base64 encodes binary strings before it sends data to
// DynamoDB, but it does not base64 decode it after it retrieves the
// data from DynamoDB. Therefore we have to check wheter it is encoded.
if (preg_match(self::BASE64_REGEX, $cipherText)) {
$cipherText = base64_decode($cipherText);
if (false === $cipherText) {
throw new \UnexpectedValueException('Error decoding data in the ' . $event->getAttribute() . ' attribute');
}
}
$plainText = $this->cipher->decrypt($cipherText);
if (false === $plainText) {
throw new \UnexpectedValueException('Error decrypting data in the ' . $event->getAttribute() . ' attribute: Invalid key');
}
$event->setValue($plainText);
}
示例2: decrypt
/**
* Decrypts a message.
*
* $this->decrypt($this->encrypt($plaintext)) == $this->encrypt($this->encrypt($plaintext)).
* At least if the continuous buffer is disabled.
*
* @see Crypt_Base::encrypt()
* @see Crypt_RC4::_crypt()
* @access public
*
* @param String $ciphertext
*
* @return String $plaintext
*/
function decrypt($ciphertext)
{
if ($this->engine == CRYPT_MODE_MCRYPT) {
return parent::decrypt($ciphertext);
}
return $this->_crypt($ciphertext, CRYPT_RC4_DECRYPT);
}
示例3: decrypt
/**
* Decrypts a message.
*
* $this->decrypt($this->encrypt($plaintext)) == $this->encrypt($this->encrypt($plaintext)).
* At least if the continuous buffer is disabled.
*
* @see Crypt_Base::encrypt()
* @see self::_crypt()
* @access public
* @param string $ciphertext
* @return string $plaintext
*/
function decrypt($ciphertext)
{
if ($this->engine != CRYPT_ENGINE_INTERNAL) {
return parent::decrypt($ciphertext);
}
return $this->_crypt($ciphertext, CRYPT_RC4_DECRYPT);
}
示例4: decrypt
/**
* Decrypts a message.
*
* Mostly a wrapper for Crypt_Base::decrypt, with some additional OpenSSL handling code
*
* @see self::encrypt()
* @access public
* @param string $ciphertext
* @return string $plaintext
*/
function decrypt($ciphertext)
{
if ($this->engine == CRYPT_ENGINE_OPENSSL) {
$temp = $this->key;
$this->key = $this->orig_key;
$result = parent::decrypt($ciphertext);
$this->key = $temp;
return $result;
}
return parent::decrypt($ciphertext);
}