From 3237dab1a419c08ebcbe3948c33247b91308eae8 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 3 Mar 2019 07:01:11 +0000 Subject: [PATCH] Added warning about an empty key --- src/Util/Crypto.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Util/Crypto.php b/src/Util/Crypto.php index 2ab97e537..54c3049ca 100644 --- a/src/Util/Crypto.php +++ b/src/Util/Crypto.php @@ -24,6 +24,9 @@ class Crypto */ public static function rsaSign($data, $key, $alg = 'sha256') { + if (empty($key)) { + logger::warning('Empty key parameter', ['callstack' => System::callstack()]); + } openssl_sign($data, $sig, $key, (($alg == 'sha1') ? OPENSSL_ALGO_SHA1 : $alg)); return $sig; } @@ -37,6 +40,9 @@ class Crypto */ public static function rsaVerify($data, $sig, $key, $alg = 'sha256') { + if (empty($key)) { + logger::warning('Empty key parameter', ['callstack' => System::callstack()]); + } return openssl_verify($data, $sig, $key, (($alg == 'sha1') ? OPENSSL_ALGO_SHA1 : $alg)); }