nayzo / NzoUrlEncryptorBundle

Symfony Bundle used to Encrypt and Decrypt data and variables in the Web application
MIT License
89 stars 19 forks source link

Symfony 6 compatibility problem #50

Closed sevenGroupFrance closed 2 years ago

sevenGroupFrance commented 2 years ago

Hi,

When triing to install this bundle on a symfony 6.0 project, i'm having an error.

composer require nzo/url-encryptor-bundle:v6.1.* or composer require nzo/url-encryptor-bundle

Give's the same error :

Executing script cache:clear [KO]
 [KO]
Script cache:clear returned with error code 255
!!  PHP Fatal error:  Declaration of Nzo\UrlEncryptorBundle\NzoUrlEncryptorBundle::getContainerExtension() must be compatible with Symfony\Component\HttpKernel\Bundle\Bundle::getContainerExtension(): ?Symfony\Component\DependencyInjection\Extension\ExtensionInterface in /var/www/gestion-inscription/vendor/nzo/url-encryptor-bundle/NzoUrlEncryptorBundle.php on line 19
nayzo commented 2 years ago

Hello,

Thank you for the issue, I fixed the compatibility error in the new tag v6.1.1

sevenGroupFrance commented 2 years ago

Thank you, it works :)

Just a little problem : cipher_algorithm is marked as optionnal cipher_algorithm: # optional, default: 'aes-256-ctr'

but i have this error : NzoEncryptor:: - unknown cipher algorithm if i don't specify any cipher_algorithm

Best regards

nayzo commented 2 years ago

You don't need to specify the cipher_algorithm it's optional, tested it in all symfony versions. The behavior you mentioned is really weird... Can I have more info plz

sevenGroupFrance commented 2 years ago

with this :

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

I was having this error : image

no more erros with this :

nzo_encryptor:
    secret_key: XXXXXXXXXXXXXXXXXXXXX # Required, max length of 100 characters.
    secret_iv:  XXXXXXXXXXXXXXXXXXXXXX # 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:                            # optional, default: TRUE
    format_base64_output:                     # optional, default: TRUE, used only when 'base64_encode' is set to TRUE
    random_pseudo_bytes:                      # optional, default: TRUE (generate a random encrypted text output each time => MORE SECURE !)
nayzo commented 2 years ago

Do you still have the issue with only this:

nzo_encryptor:
    secret_key: XXXXXXXXXXXXXXXXXXXXX
    secret_iv:  XXXXXXXXXXXXXXXXXXXXXX

Actually you should not keep the optional argument if you are not setting any value in it. So you should remove cipher_algorithm argument if you're not overriding it's value.

sevenGroupFrance commented 2 years ago

Thank you for the notice