nayzo/NzoUrlEncryptorBundle

openssl_decrypt(): IV passed is only 4 bytes long

Closed this issue · 2 comments

I have tried the following:

Code:

#[Route('/unsubscribe/{email}', name: 'app_unsubscribe')]
#[ParamDecryptor(["email"])]
public function unsubscribe($email): Response
{

}

Config:

nzo_encryptor:
    secret_key: '%env(NZO_ENCRYPTOR_SECRET)%' # Required, max length of 100 characters.
    #secret_iv:  '%env(NZO_ENCRYPTOR_IV)%' # Required only if "random_pseudo_bytes" is FALSE. Max length of 100 characters.
    #cipher_algorithm: 'aes-256-ctr'       # optional, default: 'aes-256-ctr'
    #base64_encode: TRUE                   # optional, default: TRUE
    #format_base64_output: TRUE            # optional, default: TRUE, used only when 'base64_encode' is set to TRUE
    #random_pseudo_bytes: TRUE             # optional, default: TRUE (generate a random encrypted text output each time => MORE SECURE !)

As you can see, NZO_ENCRYPTOR_IV is not defined on purpose. Now, if I go and try to access a random url param:

/unsubscribe/sadsad:

  1. I have no way of handling the error
  2. The IV seems wrong: Warning: openssl_decrypt(): IV passed is only 4 bytes long, cipher expects an IV of precisely 16 bytes, padding with \0

Any idea why is this happening?

Thanks

nayzo commented

With the same config I'm not able to reproduce the error you mentioned, It works just fine in all my tests. What version of the bundle are you using ?

nayzo commented

Closing this issue, feel free to open a new one if you think you have all the date needed to debug