We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

jquery post crypt / descrypt problem

Hii all,

$di->set('crypt', function ()use($config)
{
    $crypt = new Crypt(); $crypt->setKey($config->application->cryptSalt); return $crypt; }
);

i set di

and on my form

<input type="hidden" name="bid" class="bid" value="<?php echo $a = $this->crypt->encrypt($object->getid());?>"/>

its okey when i decrypt $a but when i want to jquery post via form serialize couldnt decrypt



26.3k

Hi!

I am not sure but I think you should encrypt it to base64 form and then decrypt it from base64 form.

It is described here in the docs: https://docs.phalcon.io/en/latest/reference/crypt.html#base64-support

Does it work now?