]> git.mxchange.org Git - friendica.git/commitdiff
Added warning about an empty key
authorMichael <heluecht@pirati.ca>
Sun, 3 Mar 2019 07:01:11 +0000 (07:01 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 3 Mar 2019 07:01:11 +0000 (07:01 +0000)
src/Util/Crypto.php

index 2ab97e5373b5a53fd276ba5ab859af6f0fbf5c2c..54c3049ca74faa679ea624b9bcc23f72c36f813e 100644 (file)
@@ -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));
        }