mogilvie / EncryptBundle

Encryption bundle
89 stars 29 forks source link

Symfony 4 - encrypt:genkey/encrypt_key #8

Closed Volmarg closed 5 years ago

Volmarg commented 5 years ago

Hello, me again.

Symfony version: 4.2.x

So before i forget or anything. Since I want to make my MIT project public later (where Your package is a part of it).

After installing Your package there are 3 problems.

I'm not having screenshots or anything, but when Your install the package and without doing anything - refresh the page You get an exception that encrypt_key was not found

I know You got to provide one by generating it via console but here actually comes next problem:

The encrypt:genkey command is wont work untill the encrypt_key will be added in yaml

(After fixing) When i try to generate key via bin/console encrypt:genkey I get: image

Summary

I've generally made my page run again but just saying that there are some problems

mogilvie commented 5 years ago

Thanks @Volmarg. I'm not running anything in Symfony 4 yet, so haven't installed it in that environment. Please feel free to fork and update if you have time or inclination. Cheers, Mark

Volmarg commented 5 years ago

Sure, with some more time i will take a look since i need to have this working anyway. :)

Volmarg commented 5 years ago

I don't know how pulling/pushing here in github works for other ppl so i just gonna type some stuff in here. I work with gitlab without problem etc. ut got no idea how to do this fast here.

EncryptorFactory.php Just changed this: public function createService($method, $encryptKey = null)

And without adding parameters to yml it seems that it's working on brand fresh project 4.3 - will test that on mine later on, as i got oly acces to WIN OS atm.

image

That would fix the problem with missing param but I dont believe it will fix missing namespace in my project even if it works on windows atm.


<1> Nvm. This doesn't help on my symfony 4.2 anyway ---- <2> Ok, this is better for problem with missing: **encrypt_key** **services.yml** ```` SpecShaper\EncryptBundle\Encryptors\EncryptorService: factory: 'SpecShaper\EncryptBundle\Encryptors\EncryptorFactory:createService' arguments: - '%spec_shaper_encrypt.method%' - '@parameter_bag' ```` **EncryptorFactory** ```` public function createService($method, $containerBag) { $encryptKey = ''; $encryptKeyStringName = 'encrypt_key'; if ($containerBag->has($encryptKeyStringName)) { $encryptKey = $containerBag->get($encryptKeyStringName); } switch($method){ default: $encryptor = new OpenSslEncryptor($encryptKey); } ````
mogilvie commented 5 years ago

Fixed in version v1.1.1