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;
I just noticed this issue also trying to set the key for the encryption. I believe this is a bug. I'm not sure if there's a way around this. I'm building an app that requires important data to be encrypted using different keys and i can store the keys related to the data somewhere else.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community