phplaravelencryptionrijndael

How to use RIJNDAEL encryption with Laravel 7 / PHP 7


I need to encrypt some .mp3 files with RIJNDAEL algorythm, i am trying to implementing it with the latest laravel version and no success so far.

What i am doing:

app.php

'cipher' => 'MCRYPT_RIJNDAEL_128',

Added to composer.json:

"ext-mcrypt": "*"

With those changes i get the following error:

The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths.

What more should/have to do ? I already did some research but no solution so far.

Thanks


Solution

  • mcrypt is insecure. Use one of the other libraries that replaced it (such as the OpenSSL based one).

    MCRYPT_RIJNDAEL_128 is Rijndael with a block cipher of 128 bits. It is also known as AES as long as you use key sizes of 128, 192 or 256 bits (for AES-128, AES-192 and AES-256 respectively).

    So just use one of the supported ciphers that are indicated, and you're all set.