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

Error, Size of IV is larger than text to decrypt,

I'm trying to decrypt using decryptBase64, i'ts a error Size of IV is larger than text to decrypt,

edited Dec '15

I think we need a bit more info on this one. Could you show us some of your code? What mode and chipper are you using? My best guess right now is that you are trying to decrypt something that is not yet encrypted!



81.1k

This is where I send my link variable to another form

<td>
    <?php echo $this->tag->linkTo(array("spm_contacto/delete/" .$this->crypt->encryptBase64($spm_contacto->CONT_CODIGO), "<img src='" . $this->url->get("img/tolbar/Delete_32x32.png") . "'>Eliminar")); ?></td>

To which I test if sending values sent encrypted or not

<?php $prueba=$this->crypt->encryptBase64($spm_contacto->CONT_CODIGO);
echo $prueba;
echo $this->crypt->decryptBase64($prueba);
?>

This is the result with many examples

SqVg4xBmCQIkHFT656DBiToN0Yz8k4w+wuQQfn+BtGa1bsyee3UsRJoFIX+rL1L2Zrhgl3XiDXGuEr5c4QT+Ew==0401014717 zqxExWmJDAIU1k7M3adUO/1C5U9ywUbp5ULlxwdYlQm1KO4REUvB9P9V1Rzden+LI4SiNMll5fWpdD7FZO4tyQ==0803784016 Ssau2QyuBBgc8eQa1cVl505zHH4wmwbOhz34pSZuDnDxOGx3DX1ztPrjdf9fTJh5knTWZQeCjr5ZZ6ShSLbBbw==0908868128 qHDZldcucpDezWYvXJBvQwTwf6eWHpZFRwqXFbMZahN/m6q6imhUKI36THEgoUdIT7UCIhGhp5o8cW3LnRjRvw==1713516779 b+eGob7Lk6DO5gFK8nBjIRXs/l4GvuR/BBjqifJV0MxwgqByQMwOZ82rSLfqx972k9BIU5b46k3SihgSjtKv1A==1716931553 Q5BTRerh8RQ25s74szSjtYJqWRp8tviO264+pyWdGf3EatO29L2JVobyVHN4zLE+7krYoxgDSAcB4un9ncl+YQ==1720566247 QZKy1oPBpukuR5SKdPOD5xs2sPVs5bMt1CLRxrzwYmo0bbjvFAiAe6aroWkFObTmoS/8jlilX6h1JL5smR8ejA==1721241899 jHV/9SJTDsUa19u7D9GH3SS4m+chAYk1mRNyfWmg+pacR27rpL3d4vEuP2+Th6vBnbukJ2/rgdzK29sqthPOmw==1723995336 yBbE/lPatFc68gplLvTdb/VQp0ehAAwVZnEi/FQSKcmDAQxd/Y6ue11OeZrW6k1w5aVu2y59HhizbGf9C9nQRg==1724130693 2s7ylO4QeNSPaVaBnF8gFJmRGq+Zu5bSyFlg0gHuMEUxzPGvZcShIxR8an5CUjtlDuTojZQrpi0x59GtFTMq9g==1724908197

In my controller that receives the variable is so

echo $CONT_CODIGO;
echo $this->crypt->decryptBase64(trim($CONT_CODIGO));
$spm_contacto = SpmContacto::findFirstByCONT_CODIGO($this->crypt->decryptBase64($CONT_CODIGO));
    if (!$spm_contacto) {
        $this->flash->error("spm_contacto was not found");

        return $this->dispatcher->forward(array(
            "controller" => "spm_contacto",
            "action" => "index"
        ));
    }

But the result is

C9YNI1bl4LQ0OBVoyMSybdVv4�8���C�9��K2�sspm_contacto was not found

I am experiencing the same issue. Have you found a solution?

This is where I send my link variable to another form

<td> <?php echo $this->tag->linkTo(array("spm_contacto/delete/" .$this->crypt->encryptBase64($spm_contacto->CONT_CODIGO), "<img src='" . $this->url->get("img/tolbar/Delete_32x32.png") . "'>Eliminar")); ?></td> To which I test if sending values sent encrypted or not

<?php $prueba=$this->crypt->encryptBase64($spm_contacto->CONT_CODIGO); echo $prueba; echo $this->crypt->decryptBase64($prueba); ?> This is the result with many examples

SqVg4xBmCQIkHFT656DBiToN0Yz8k4w+wuQQfn+BtGa1bsyee3UsRJoFIX+rL1L2Zrhgl3XiDXGuEr5c4QT+Ew==0401014717 zqxExWmJDAIU1k7M3adUO/1C5U9ywUbp5ULlxwdYlQm1KO4REUvB9P9V1Rzden+LI4SiNMll5fWpdD7FZO4tyQ==0803784016 Ssau2QyuBBgc8eQa1cVl505zHH4wmwbOhz34pSZuDnDxOGx3DX1ztPrjdf9fTJh5knTWZQeCjr5ZZ6ShSLbBbw==0908868128 qHDZldcucpDezWYvXJBvQwTwf6eWHpZFRwqXFbMZahN/m6q6imhUKI36THEgoUdIT7UCIhGhp5o8cW3LnRjRvw==1713516779 b+eGob7Lk6DO5gFK8nBjIRXs/l4GvuR/BBjqifJV0MxwgqByQMwOZ82rSLfqx972k9BIU5b46k3SihgSjtKv1A==1716931553 Q5BTRerh8RQ25s74szSjtYJqWRp8tviO264+pyWdGf3EatO29L2JVobyVHN4zLE+7krYoxgDSAcB4un9ncl+YQ==1720566247 QZKy1oPBpukuR5SKdPOD5xs2sPVs5bMt1CLRxrzwYmo0bbjvFAiAe6aroWkFObTmoS/8jlilX6h1JL5smR8ejA==1721241899 jHV/9SJTDsUa19u7D9GH3SS4m+chAYk1mRNyfWmg+pacR27rpL3d4vEuP2+Th6vBnbukJ2/rgdzK29sqthPOmw==1723995336 yBbE/lPatFc68gplLvTdb/VQp0ehAAwVZnEi/FQSKcmDAQxd/Y6ue11OeZrW6k1w5aVu2y59HhizbGf9C9nQRg==1724130693 2s7ylO4QeNSPaVaBnF8gFJmRGq+Zu5bSyFlg0gHuMEUxzPGvZcShIxR8an5CUjtlDuTojZQrpi0x59GtFTMq9g==1724908197

In my controller that receives the variable is so

echo $CONT_CODIGO; echo $this->crypt->decryptBase64(trim($CONT_CODIGO)); $spm_contacto = SpmContacto::findFirstByCONT_CODIGO($this->crypt->decryptBase64($CONT_CODIGO)); if (!$spm_contacto) { $this->flash->error("spm_contacto was not found");

       return $this->dispatcher->forward(array(
           "controller" => "spm_contacto",
           "action" => "index"
       ));
   }

But the result is

C9YNI1bl4LQ0OBVoyMSybdVv4�8���C�9��K2�sspm_contacto was not found