DoctrineEncryptBundle icon indicating copy to clipboard operation
DoctrineEncryptBundle copied to clipboard

Invalid message authentication code

Open sterichards opened this issue 1 year ago • 2 comments

I get this error on decrypt using 5.1

The encryption happens on a different project using paragonie/halite 4.6 which matches the version that this bundle uses

I can echo out the value of $data on line 44 of vendor/michaeldegroot/doctrine-encrypt-bundle/src/Encryptors/HaliteEncryptor.php and it shows the decrypted value without a problem

Something happens after that which generates the error "Invalid message authentication code" In Crypto.php line 193

After further investigation, the error is triggered from this check - if ($config->MAC_ALGO === 'BLAKE2b')

sterichards avatar Apr 06 '23 14:04 sterichards

@sterichards it seems like the issues might have been in paragonie/halite. See issue: https://github.com/paragonie/halite/issues/161

Seems that their version 5.x did not have the issue, see last comment in the above issue.

Possible for you to upgrade to 5.x? This repository allows for paragonie/halite 5.x to be used: https://github.com/DoctrineEncryptBundle/DoctrineEncryptBundle

r3hp1c avatar Jul 25 '23 07:07 r3hp1c

Unsure if it's related, but I've had this same error if my .Halite.key file gets a newline at the end of. Which it does automatically if you open it in most text editors :facepalm:

ndench avatar Jan 02 '24 04:01 ndench