jsonld signature issue (library is using sha1, spec requires sha256)
This commit is contained in:
parent
d83fe9d417
commit
5cc19ce053
@ -4301,7 +4301,7 @@ class JsonLdProcessor {
|
|||||||
sort($nquads);
|
sort($nquads);
|
||||||
|
|
||||||
// cache and return hashed quads
|
// cache and return hashed quads
|
||||||
$hash = $bnodes->{$id}->hash = sha1(implode($nquads));
|
$hash = $bnodes->{$id}->hash = hash('sha256',implode($nquads));
|
||||||
return $hash;
|
return $hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4320,8 +4320,8 @@ class JsonLdProcessor {
|
|||||||
* @return stdClass the hash and path namer used.
|
* @return stdClass the hash and path namer used.
|
||||||
*/
|
*/
|
||||||
protected function _hashPaths($id, $bnodes, $namer, $path_namer) {
|
protected function _hashPaths($id, $bnodes, $namer, $path_namer) {
|
||||||
// create SHA-1 digest
|
// create digest
|
||||||
$md = hash_init('sha1');
|
$md = hash_init('sha256');
|
||||||
|
|
||||||
// group adjacent bnodes by hash, keep properties and references separate
|
// group adjacent bnodes by hash, keep properties and references separate
|
||||||
$groups = new stdClass();
|
$groups = new stdClass();
|
||||||
@ -4350,7 +4350,7 @@ class JsonLdProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// hash direction, property, and bnode name/hash
|
// hash direction, property, and bnode name/hash
|
||||||
$group_md = hash_init('sha1');
|
$group_md = hash_init('sha256');
|
||||||
hash_update($group_md, $direction);
|
hash_update($group_md, $direction);
|
||||||
hash_update($group_md, $quad->predicate->value);
|
hash_update($group_md, $quad->predicate->value);
|
||||||
hash_update($group_md, $name);
|
hash_update($group_md, $name);
|
||||||
@ -4433,7 +4433,7 @@ class JsonLdProcessor {
|
|||||||
$path_namer = $chosen_namer;
|
$path_namer = $chosen_namer;
|
||||||
}
|
}
|
||||||
|
|
||||||
// return SHA-1 hash and path namer
|
// return hash and path namer
|
||||||
return (object)array(
|
return (object)array(
|
||||||
'hash' => hash_final($md), 'pathNamer' => $path_namer);
|
'hash' => hash_final($md), 'pathNamer' => $path_namer);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user