本文整理汇总了PHP中Illuminate\Encryption\Encrypter::decrypt方法的典型用法代码示例。如果您正苦于以下问题:PHP Encrypter::decrypt方法的具体用法?PHP Encrypter::decrypt怎么用?PHP Encrypter::decrypt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Encryption\Encrypter
的用法示例。
在下文中一共展示了Encrypter::decrypt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: restore
/**
* Restore the value.
*
* @param $value
* @return string
*/
public function restore($value)
{
if (array_get($this->fieldType->getConfig(), 'auto_decrypt') === true) {
return $this->encrypter->decrypt($value);
}
return $value;
}
示例2: decrypted
/**
* Decrypt the value.
*
* @return string
*/
public function decrypted()
{
if (!($value = $this->object->getValue())) {
return null;
}
return $this->encrypter->decrypt($value);
}
示例3: decrypt
/**
* Decrypt the given cookie value.
*
* @param string $value
* @return mixed|null
*/
protected function decrypt($value)
{
try {
return $this->encrypter->decrypt($value);
} catch (\Exception $e) {
return null;
}
}
示例4: decrypt
/**
* Decrypt the cookies on the request.
*
* @param \Symfony\Component\HttpFoundation\Request $request
* @return \Symfony\Component\HttpFoundation\Request
*/
protected function decrypt(Request $request)
{
foreach ($request->cookies as $key => $c) {
try {
$request->cookies->set($key, $this->encrypter->decrypt($c));
} catch (DecryptException $e) {
$request->cookies->set($key, null);
}
}
return $request;
}
示例5: decrypted
/**
* Decrypt the value.
*
* @return string
*/
public function decrypted()
{
if (!($value = $this->object->getValue())) {
return null;
}
// Return the value if it's already decoded.
if (array_get($this->object->getConfig(), 'auto_decrypt') === true) {
return $value;
}
return $this->encrypter->decrypt($value);
}
示例6: get
/**
* Retrieve an item from the cache by key.
*
* @param string $key
* @return mixed
*/
public function get($key)
{
$key = $this->prefix . $key;
$cache = $this->getCacheCollection()->where('key', $key)->first();
// If we have a cache record we will check the expiration time against current
// time on the system and see if the record has expired. If it has, we will
// remove the records from the database collection so it isn't returned again.
if (!is_null($cache)) {
if (time() >= $cache['expiration']->sec) {
return $this->forget($key);
}
return $this->encrypter->decrypt($cache['value']);
}
}
示例7: deserializeToken
/**
* Deserializes token.
*
* @param string $payload
* @return AuthToken|null
*/
public function deserializeToken($payload)
{
try {
$data = $this->encrypter->decrypt($payload);
} catch (DecryptException $e) {
return null;
}
if (empty($data['id']) || empty($data['key'])) {
return null;
}
$token = $this->generateAuthToken($data['key']);
$token->setAuthIdentifier($data['id']);
return $token;
}
示例8: deserializeToken
/**
* Deserializes token.
*
* @param string $payload
* @return AuthToken|null
*/
public function deserializeToken($payload)
{
try {
$payload = str_replace(array('-', '_'), array('+', '/'), $payload);
$data = $this->encrypter->decrypt($payload);
} catch (DecryptException $e) {
return null;
}
if (empty($data['id']) || empty($data['key']) || empty($data['userAgent'])) {
return null;
}
$token = $this->generateAuthToken($data['key']);
$token->setAuthIdentifier($data['id']);
$token->setUserAgent($data['userAgent']);
return $token;
}
示例9: readCallback
public static function readCallback($payload)
{
$crypt = new Encrypter(base64_decode(Config::get('services.etupay.key')), 'AES-256-CBC');
$payload = json_decode($crypt->decrypt($payload));
if ($payload && is_numeric($payload->service_data)) {
$paymentId = $payload->service_data;
$payment = Payment::findOrFail($paymentId);
switch ($payload->step) {
case 'INITIALISED':
$payment->state = 'returned';
break;
case 'PAID':
case 'AUTHORISATION':
$payment->state = 'paid';
break;
case 'REFUSED':
case 'CANCELED':
$payment->state = 'refused';
break;
case 'REFUNDED':
$payment->state = 'refunded';
break;
}
$payment->informations = ['transaction_id' => $payload->transaction_id];
$payment->save();
if ($payment->newcomer) {
$payment->newcomer->updateWei();
} elseif ($payment->student) {
$payment->student->updateWei();
}
return $payment;
}
return null;
}
示例10: get
/**
* Retrieve an item from the cache by key.
*
* @param string $key
* @return mixed
*/
public function get($key)
{
$prefixed = $this->prefix . $key;
$cache = $this->table()->where('key', '=', $prefixed)->first();
// If we have a cache record we will check the expiration time against current
// time on the system and see if the record has expired. If it has, we will
// remove the records from the database table so it isn't returned again.
if (!is_null($cache)) {
if (is_array($cache)) {
$cache = (object) $cache;
}
if (time() >= $cache->expiration) {
return $this->forget($key);
}
return $this->encrypter->decrypt($cache->value);
}
}
示例11: decryptArray
/**
* Decrypt an array based cookie.
*
* @param array $cookie
* @return array
*/
protected function decryptArray(array $cookie)
{
$decrypted = array();
foreach ($cookie as $key => $value) {
$decrypted[$key] = $this->encrypter->decrypt($value);
}
return $decrypted;
}
示例12: validateCredentials
/**
* Validate a user against the given credentials.
*
* @param \Illuminate\Auth\UserInterface $user
* @param array $credentials
* @return bool
*/
public function validateCredentials(UserInterface $user, array $credentials)
{
$plain = $credentials['password'];
if ($this->encryptedPassword) {
return $plain == $this->encrypter->decrypt($user->getAuthPassword());
}
return $this->hasher->check($plain, $user->getAuthPassword());
}
示例13: marshalPushedJob
/**
* Marshal out the pushed job and payload.
*
* @throws \Exception
* @return object
*/
protected function marshalPushedJob()
{
$id = $this->request->header('x-zend-job-id');
$payload = $this->request->input("payload");
if (empty($payload)) {
throw new \Exception("Payload Not Found.");
}
$body = $this->crypt->decrypt($payload);
return (object) ['id' => $id, 'body' => $body, 'pushed' => true];
}
示例14: decrypt
/**
* Descriptografa os dados.
*
* @param array $data
* @return array
*/
public function decrypt(array $data)
{
if (!isset($data['secret'])) {
return $data;
}
$key = md5($data['secret'] . '-' . Config::get('app.key'));
$cipher = Config::get('app.cipher');
$encrypter = new Encrypter($key, $cipher);
foreach ($data as $key => $value) {
if (!empty($value) and in_array($key, $this->getEncryptable())) {
$data[$key] = $encrypter->decrypt($value);
}
}
return $data;
}
示例15: marshalPushedJob
/**
* Marshal out the pushed job and payload.
*
* @return StdClass
*/
protected function marshalPushedJob()
{
$r = $this->request;
$body = $this->crypt->decrypt($r->getContent());
return (object) array('id' => $r->header('iron-message-id'), 'body' => $body, 'pushed' => true);
}