kopia lustrzana https://github.com/nextcloud/social
				
				
				
			fixing signature check
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>pull/586/head
							rodzic
							
								
									a1221cacf6
								
							
						
					
					
						commit
						e85bb3495c
					
				|  | @ -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, '')); | ||||
|  |  | |||
|  | @ -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; | ||||
|  |  | |||
		Ładowanie…
	
		Reference in New Issue
	
	 Maxence Lange
						Maxence Lange