I am working on a Cakephp 2.6 I’m trying to encrypt my data which i am storing into db
For example i have a function in controller which is saving data:
$data = $this->request->data;
$data['card_serial'] = Security::encrypt($data['card_serial'], SECURITY_CODE);
$this->Card->save($data);
And view, I’m trying to decrypt:
<td> <?php echo Security::decrypt($record['Card']['card_serial'], SECURITY_CODE); ?> </td>
I have done this but didnt work
Error: [CakeException] The data to decrypt cannot be empty.