Skip to content

Encryption Class - Decrypting: authentication failed #3258

Description

@Jack-Dane

I have used the Encryption class to encrypt some data, setting the key in the config file, but when I try to decrypt i receive an error message:

CodeIgniter\Encryption\Exceptions\EncryptionException
Decrypting: authentication failed.
SYSTEMPATH\Encryption\Exceptions\EncryptionException.php at line 34

I believe to be following the documentation provided correctly:
https://codeigniter.com/user_guide/libraries/encryption.html#configuration

Here is my code to encrypt:

$encrypter = \Config\Services::encrypter();
$userAccount["Email"] = $encrypter->encrypt($accountData["email"]);

Here is my code to decrypt:

$encrypter = \Config\Services::encrypter();
$result->Email = $encrypter->decrypt($result->Email);

The same error has been asked here on StackOverflow

https://stackoverflow.com/questions/62781769/decrypt-showing-error-authentication-failed

Thanks

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions