Merge pull request #6798 from annando/key-warning

Added warning about an empty key
2022.09-rc
Philipp 2019-03-04 08:30:20 +01:00 zatwierdzone przez GitHub
commit e157c89dc7
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 17 dodań i 0 usunięć

Wyświetl plik

@ -1209,6 +1209,16 @@ class Transmitter
{
$owner = User::getOwnerDataById($uid);
if (empty($owner)) {
Logger::error('No owner data found, the deletion message cannot be processed.', ['user' => $uid]);
return false;
}
if (empty($owner['uprvkey'])) {
Logger::error('No private key for owner found, the deletion message cannot be processed.', ['user' => $uid]);
return false;
}
$data = ['@context' => ActivityPub::CONTEXT,
'id' => System::baseUrl() . '/activity/' . System::createGUID(),
'type' => 'Delete',

Wyświetl plik

@ -7,6 +7,7 @@ namespace Friendica\Util;
use Friendica\Core\Config;
use Friendica\Core\Hook;
use Friendica\Core\Logger;
use Friendica\Core\System;
use ASN_BASE;
use ASNValue;
@ -24,6 +25,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 +41,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));
}