X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FUtil%2FLDSignature.php;h=b2b6c90db25d2f148015a62e5a3ab4bced4ac94d;hb=05bd0d0b671ad509465fa6cddabc3c2a07c796a7;hp=7776ec96c26f320b8c4cb8f4b217c3b0cf11e088;hpb=4ae37c61966a7f4c055369ee8fd0d4bc20808fdb;p=friendica.git diff --git a/src/Util/LDSignature.php b/src/Util/LDSignature.php index 7776ec96c2..b2b6c90db2 100644 --- a/src/Util/LDSignature.php +++ b/src/Util/LDSignature.php @@ -1,14 +1,31 @@ . + * + */ namespace Friendica\Util; -use Friendica\Util\JsonLD; -use Friendica\Util\DateTimeFormat; -use Friendica\Protocol\ActivityPub; +use Friendica\Core\Logger; use Friendica\Model\APContact; /** - * @brief Implements JSON-LD signatures + * Implements JSON-LD signatures * * Ported from Osada: https://framagit.org/macgirvin/osada */ @@ -26,7 +43,7 @@ class LDSignature } $actor = JsonLD::fetchElement($data, 'actor', 'id'); - if (empty($actor)) { + if (empty($actor) || !is_string($actor)) { return false; } @@ -40,7 +57,7 @@ class LDSignature $dhash = self::hash(self::signableData($data)); $x = Crypto::rsaVerify($ohash . $dhash, base64_decode($data['signature']['signatureValue']), $pubkey); - logger('LD-verify: ' . intval($x)); + Logger::log('LD-verify: ' . intval($x)); if (empty($x)) { return false; @@ -53,7 +70,7 @@ class LDSignature { $options = [ 'type' => 'RsaSignature2017', - 'nonce' => random_string(64), + 'nonce' => Strings::getRandomHex(64), 'creator' => $owner['url'] . '#main-key', 'created' => DateTimeFormat::utcNow(DateTimeFormat::ATOM) ];