OpenSSL error:80000003:system library::No such process - Hack The Tech - Latest News related to Computer and Technology

Hack The Tech - Latest News related to Computer and Technology

Get Daily Latest News related to Computer and Technology and hack the world.

Monday, November 13, 2023

OpenSSL error:80000003:system library::No such process

Problem

I am trying to generate a private key by openssl library in PHP. But it is returning me false(bool) if I vardump. when I traced the error via openssl_error_string() I got

error:80000003:system library::No such process

My code:

// Generate a private key
$privateKey = openssl_pkey_new(array(
    'private_key_bits' => 2048,
    'private_key_type' => OPENSSL_KEYTYPE_RSA,
));

if ($privateKey === false) {
    echo "Error: " . openssl_error_string();
}
die();

What I tried

I checked wether or not openssl installed by, php -m and got:

[PHP Modules]
...
openssl
...

When I went to php.ini there I saw, ;extension=openssl then I uncommented it and ran and I got:

PHP Warning:  Module "openssl" is already loaded in Unknown on line 0

Warning: Module "openssl" is already loaded in Unknown on line 0
Error: error:80000003:system library::No such process

Then I recommented it. And still not working...

[Note: I am using XAMPP server on Windows 11]

Now, as for duplicate questions,

  1. Why does openssl_pkey_new() fail?

    The Answer in this question says

    Use openssl_error_string() to find out why openssl_pkey_new() is returning false (or any other OpenSSL error). After your latest update, it appears that OpenSSL can't find the openssl.cnf file, as described here.

    I tried the first part of tracing and I got no solution thus I asked this question and as for the link provided, it says

    To use PHP's OpenSSL support you must also compile PHP --with-openssl[=DIR].

    I did not understand what that meant. Like what to compile and how? I am using XAMPP.

  2. xampp openssl errors when calling openssl_pkey_new();

    First of all, what he tried and what I tried are different. The answer to this says:

    Maybe you need to specify the path to your openssl.cnf file when calling openssl_pkey_new(). You may also need to specify additional settings in $configArgs for the function to work (have not tested that lately).

    and the path to include he gave is for linux. WHat do I do In windows XAMPP? What is the actually problem causing this? Do I always need to include those paths? what about production environment?



source https://stackoverflow.com/questions/77459765/openssl-error80000003system-libraryno-such-process

No comments:

Post a Comment