本文整理匯總了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);
}