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-Key: 347437

Url: https://administrator.de/contentid/347437

Printed on: April 16, 2024 at 15:04 o'clock

Member: StefanKittel
StefanKittel Aug 27, 2017 at 08:17:07 (UTC)
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.
Member: Arano
Arano Aug 27, 2017 at 09:20:31 (UTC)
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
Member: StefanKittel
StefanKittel Aug 27, 2017 at 20:24:50 (UTC)
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