vendredi 28 janvier 2022

Found an 'Invalid payload' Error when decrypting using Laravel decryptSting function

When I am decrypting this value I am getting below error (This data is received from another service. So we have to decrypt it and store in our db)

$data - 'UeJOR76YHezWdjl6hxVV7Q=='

APP_KEY - [32 character key]

In config/app.php

'cipher' => 'AES-256-CBC'

Laravel version - Laravel Framework 5.6.39

In Encrypter.php line 191:

  [Illuminate\Contracts\Encryption\DecryptException]
  The payload is invalid.


Exception trace:
 () at /media/sf_vbshared/www/viaduct/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php:191
 Illuminate\Encryption\Encrypter->getJsonPayload() at /media/sf_vbshared/www/viaduct/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php:134
 Illuminate\Encryption\Encrypter->decrypt() at /media/sf_vbshared/www/viaduct/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:223
 Illuminate\Support\Facades\Facade::__callStatic() at /media/sf_vbshared/www/viaduct/app/Console/Commands/CleanPlayers.php:276
 App\Console\Commands\CleanPlayers->decrypt() at /media/sf_vbshared/www/viaduct/app/Console/Commands/CleanPlayers.php:81
 App\Console\Commands\CleanPlayers->cleanPlayer() at /media/sf_vbshared/www/viaduct/app/Console/Commands/CleanPlayers.php:65
 App\Console\Commands\CleanPlayers->handle() at n/a:n/a

Below is the laravel code I used to decrypt


#decrypted = Crypt::decryptString( $data );

I know laravel Crypt uses AES256 encryption algorithm. Is there any wrong with data here ? is this data is not compatible to AES256 algo?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire