Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

nithiyakumar's avatar

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

Hi, I'm new to Laravel after installing laravel php artisan key:generate Application key [base64:123456789101245q1vW4fCfzjFZyR5w8cwG5clMHZ1s=] (some chars are changed)

In documentation it menstion 16 or 32 characters key should generated but, why I'm getting this 44characters as key?

I modify config/app.php - ciphers AES-256-CBC and Encrypter.php - ciphers AES-256-CBC

0 likes
5 replies
Bonsi's avatar

The hint in the "base64": base64 is used to store binary data (the application key) in ascii. Because of how base64 works (uses 4 bytes to store 3 bytes of data) the data length could increase up to 33% (approx.) of the original data length.

nithiyakumar's avatar

@Bonsi Thanks for your reply, what is the solution for that RuntimeException in Encrypter.php line 43: The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths.

nithiyakumar's avatar

Finally works,

  • delete .env file
  • copy .env.example .env
  • php artisan key:generate
  • remove env() in 'key' in config/app.php
Bonsi's avatar

Good to hear ;) Something that caught my eye in your OP was that your key started with "12345678910". Not that it is impossible to have a base64 string start with that, but it's way more likely that that string came from somewhere else in the first place, and thus corrupting your key as it were. Anyways, regenerating your application key took care of that ;)

nithiyakumar's avatar

Hi, [base64:123456789101245q1vW4fCfzjFZyR5w8cwG5clMHZ1s=] (some chars are changed)

Notice that, Here I change some characters in the key

suggestion appreciate.. Thanks

Please or to participate in this conversation.