Do you need input there also?
Feb 16, 2016
4
Level 1
Crypt::decrypt error
Hi,
I have a CardsController that encrypts the card number on the store method like this:
$input = Request::all();
$input['card_number'] = \Crypt::encrypt($input['card_number']);
The above works great.
But when I try to decrypt the card number in the view method, I get an error saying "DecryptException in BaseEncrypter.php line 45: The payload is invalid."
Here is my code:
$card = Card::findOrFail($id);
$card['card_number'] = \Crypt::decrypt($card->card_number);
Any idea? Thanks
Level 122
I hope these are not credit cards =:-\
The problem might be in the storage rather than the retrieval?
Have you checked that there is actually encrypted data in the column?
Is the column big enough (I guess that would throw an error)
Have you added card_number to the $fillable array?
1 like
Please or to participate in this conversation.