stefankittel
Goto Top

PHP Openssl openssl error string zeigt sinnlose Informationen an

Hallo,

ich teste gerade eine Klasse mit Openssl in PHP 7.1.
Dabei ist mir aufgefallen, dass openssl_error_string nur sinnlose Informationen anzeigt.

Wenn ich z.B. eine Schlüssellänge von 8 Bit wähle, was ungültig ist, bekomme ich diese Informationen:
openssl_error_string = error:02001003:system library:fopen:No such process

Allerdings bekomme ich eine PHP Warning mit folgendem Text
PHP Warning: openssl_pkey_new(): private key length is too short; it needs to be at least 384 bits, not 12

Gibt es in openssl eine Funktion um diese 2. Fehlermeldung zu erhalten?

Danke

Stefan

Content-ID: 347437

Url: https://administrator.de/forum/php-openssl-openssl-error-string-zeigt-sinnlose-informationen-an-347437.html

Ausgedruckt am: 08.04.2025 um 22:04 Uhr

StefanKittel
StefanKittel 27.08.2017 um 10:17:07 Uhr
Goto Top
Ich habe nun ein "error_get_last()['message']" hinzugefügt.
Ist aber nicht optimal, da hier auch eine andere Fehlermeldung stehen könnte.
Arano
Arano 27.08.2017 um 11:20:31 Uhr
Goto Top
Moin.

Ich habe mal ins Manual geschaut: Die Meldungen landen in einer Warteschlange und werden einzeln abgerufen.

openssl_error_string() returns the last error from the openSSL library. Error messages are queued, so this function should be called multiple times to collect all of the information. The last error will be the most recent one.


~Arano
StefanKittel
StefanKittel 27.08.2017 um 22:24:50 Uhr
Goto Top
Hallo,

habe ich ausprobiert. Ist aber wenig zufiredenstellen.

Hier die Ausgaben von "openssl_error_string" bis nix mehr kommt.
E:error:02001003:system library:fopen:No such process
E:error:2006D080:BIO routines:BIO_new_file:no such file
E:error:0E064002:configuration file routines:CONF_load:system lib
E:error:0E06D06C:configuration file routines:NCONF_get_string:no value
E:error:0E06D06C:configuration file routines:NCONF_get_string:no value
E:error:0E06D06C:configuration file routines:NCONF_get_string:no value
E:error:0E06D06C:configuration file routines:NCONF_get_string:no value

Hier die Ausgabe von "error_get_last()['message']"
PHP Warning: openssl_pkey_new(): private key length is too short; it needs to be at least 384 bits, not 1 in .....\ssltest.php on line 87

Die Meldung von PHP ist auf den Punkt. die von openssl quasi nichtssagend

Viele Grüße

Stefan