Read openssl error and log

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
This commit is contained in:
Daniel Kesselberg 2018-12-06 21:27:57 +01:00
parent bc35bf14f0
commit ec8aefc762
No known key found for this signature in database
GPG Key ID: 36E3664E099D0614
1 changed files with 11 additions and 1 deletions

View File

@ -295,6 +295,10 @@ class PublicKeyTokenProvider implements IProvider {
// Generate new key
$res = openssl_pkey_new($config);
if ($res === false) {
$this->logOpensslError();
}
openssl_pkey_export($res, $privateKey);
// Extract the public key from $res to $pubKey
@ -343,5 +347,11 @@ class PublicKeyTokenProvider implements IProvider {
}
}
private function logOpensslError() {
$errors = [];
while ($error = openssl_error_string()) {
$errors[] = $error;
}
$this->logger->critical('Something is wrong with your openssl setup: ' . implode(', ', $errors));
}
}