Open sunweaver opened 4 years ago
Is there a reason to remove the cipher from the parameter list in cred_encrypt
?
Have you tried to decrypt a previously encrypted gosa.conf ?
I stumbled across this in the new gosa_v2.8_PHP8.1 branch. We definitely should consider merging ASAP.
Maybe we should use a more sophisticated approach.
We can assemble an array of ciphers which don't need an init vector. (is this too maintenance-heavy maybe?) Then we match the desired cipher with the list and decide if we use the "old" method or sunweavers approach.
I think this would ensure backwards compatibility and a fix for default aes-256-ecb.
EDIT:
Or instead we just check $ivlen, if null then use new approach, if not null then use old approach :)
So I've implemented my idea, please consider merging quickly.
So... I've tested this quite a bit now.. @master-caster can you review this again? :)
…evious PHP versions silently ignored.
PHP 7.4 chokes with...
... because the chosen method (aes-256-ecb) doesn't use an initialization vector ($iv) at all, causing its length ($ivlen) to be 0, see e.g. https://usr.ed48.com/php/ssl/?xf=7
So the encrypt/decrypt implementation seems to have been sort of wrong before (and only now with PHP 7.4 an error is thrown).
See Debian bug https://bugs.debian.org/964318