diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2019-06-21 10:21:15 -0100 |
---|---|---|
committer | Maxence Lange <maxence@artificial-owl.com> | 2019-06-21 10:21:15 -0100 |
commit | e85bb3495c042a969eca79924bee64c032307c8b (patch) | |
tree | be8a09a9aebd4160ac46a4c9f8c8e83853d9dec6 | |
parent | a1221cacf6dc9dbdffc1929f361e9c2e942c049d (diff) |
fixing signature check
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
-rw-r--r-- | lib/Model/LinkedDataSignature.php | 8 | ||||
-rw-r--r-- | lib/Service/SignatureService.php | 7 |
2 files changed, 10 insertions, 5 deletions
diff --git a/lib/Model/LinkedDataSignature.php b/lib/Model/LinkedDataSignature.php index d2e46d20..9baacd64 100644 --- a/lib/Model/LinkedDataSignature.php +++ b/lib/Model/LinkedDataSignature.php @@ -320,13 +320,13 @@ class LinkedDataSignature implements JsonSerializable { */ public function import(array $data) { - if (!in_array(ACore::CONTEXT_SECURITY, $this->getArray('@context', $data, []))) { - throw new LinkedDataSignatureMissingException(); - } +// if (!in_array(ACore::CONTEXT_SECURITY, $this->getArray('@context', $data, []))) { +// throw new LinkedDataSignatureMissingException('no @context security entry'); +// } $signature = $this->getArray('signature', $data, []); if ($signature === []) { - throw new LinkedDataSignatureMissingException(); + throw new LinkedDataSignatureMissingException('missing signature'); } $this->setType($this->get('type', $signature, '')); diff --git a/lib/Service/SignatureService.php b/lib/Service/SignatureService.php index 00f6b906..dc7c1452 100644 --- a/lib/Service/SignatureService.php +++ b/lib/Service/SignatureService.php @@ -127,7 +127,7 @@ class SignatureService { public function generateKeys(Person &$actor) { $res = openssl_pkey_new( [ - "digest_alg" => "rsa", + "digest_alg" => "rsa", "private_key_bits" => 2048, "private_key_type" => OPENSSL_KEYTYPE_RSA, ] @@ -232,6 +232,7 @@ class SignatureService { * @throws ItemUnknownException * @throws RequestResultNotJsonException * @throws DateTimeException + * @throws UnauthorizedFediverseException */ public function checkObject(ACore $object): bool { try { @@ -263,6 +264,10 @@ class SignatureService { return true; } catch (LinkedDataSignatureMissingException $e) { + $this->miscService->log( + 'LinkedDataSignatureMissingException while checkObject : ' . $e->getMessage() + . ' --- ' . json_encode($object), 1 + ); } return false; |