Aug 21, 2014
0
Level 8
Session fails when using Crypt facade
Hello,
I am having an issue with the Crypt facade in Laravel. When I execute the code below, and then refresh a page, the Session facade cannot find anything and I am assuming it is still using the new values for Crypt that I just set. I was under the impression that the Crypt facade will only take affect for one request, and then start using the default values again. I've even tried to reset the cipher, key, and mode back to default values after decrypting my value.
Does anyone see any issues with my code?
Thanks, Nate
$dns = DnsInfo::find($this->fk_id);
$company = Company::find($dns->fk_id);
$keyPrefix = $dns->tenant_code . $company->id . $dns->fk_type . $dns->id . $this->fk_type;
Crypt::setKey($keyPrefix . Config::get('app.encryption_key'));
Crypt::setCipher('rijndael-256');
Crypt::setMode('ecb');
$value = Crypt::decrypt($this->value);
return $value;
Please or to participate in this conversation.