What does this error mean after calling the openssl_encrypt function?

Asked

Viewed 100 times

3

When calling the function openssl_encrypt, always returned false. When checking the function openssl_error_string, I get the following error:

error:0906D06C:PEM routines:Pem_read_bio:no start line

The code I’m doing the tests is this:

$data = 'Olá, Wallace!';

$encryption_key = openssl_random_pseudo_bytes(32);

$iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length('AES-256-CBC'));

$encrypted = openssl_encrypt($data, 'AES-256-CBC', $encryption_key, 0, $iv);

if (false === $encrypted) {

    var_dump(openssl_error_string());

    exit;
}

Why this error is generated?

I’m doing these tests trying to find a solution to this question:

/questions/185919/erro-de-encryption%C3%A7%C3%A3o-no-Laravel-ap%C3%B3s-actualize%C3%A7%C3%A3o-do-php-could-not-Encrypt-the-d

  • Hello, I ran the code here and it worked right, Ubuntu with PHP 7.0. Which OS and PHP version you are using?

  • I was using version 5.6 of PHP

  • Hello, and what OS-Operating System?

  • My OS is Linux, Ubuntu 16.04

  • Idem here, Ubuntu 16.04 64-bit LTS, but from what I know, the default version that comes from PHP is 7, I ran the code here and it works cool, as you are in version 5.6 must have changed some configuration and maybe started generating this error?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.