diff options
author | Mario <mario@mariovavti.com> | 2021-02-09 13:50:03 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2021-02-09 13:50:03 +0000 |
commit | b4693870ba647455e6bd0a3919a544130cee118b (patch) | |
tree | 97fe6de09c5ce3b5e6ed247c6a6105008631e79a /Zotlabs/Lib/LDSignatures.php | |
parent | 5aee2f172ecdf58e13dd328c787fd199c48d24c5 (diff) | |
download | volse-hubzilla-b4693870ba647455e6bd0a3919a544130cee118b.tar.gz volse-hubzilla-b4693870ba647455e6bd0a3919a544130cee118b.tar.bz2 volse-hubzilla-b4693870ba647455e6bd0a3919a544130cee118b.zip |
port Lib/Crypto from zap
Diffstat (limited to 'Zotlabs/Lib/LDSignatures.php')
-rw-r--r-- | Zotlabs/Lib/LDSignatures.php | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Zotlabs/Lib/LDSignatures.php b/Zotlabs/Lib/LDSignatures.php index 2eba66ccf..1c2095f10 100644 --- a/Zotlabs/Lib/LDSignatures.php +++ b/Zotlabs/Lib/LDSignatures.php @@ -12,7 +12,7 @@ class LDSignatures { $ohash = self::hash(self::signable_options($data['signature'])); $dhash = self::hash(self::signable_data($data)); - $x = rsa_verify($ohash . $dhash,base64_decode($data['signature']['signatureValue']), $pubkey); + $x = Crypto::verify($ohash . $dhash,base64_decode($data['signature']['signatureValue']), $pubkey); logger('LD-verify: ' . intval($x)); return $x; @@ -35,11 +35,11 @@ class LDSignatures { $ohash = self::hash(self::signable_options($options)); $dhash = self::hash(self::signable_data($data)); - $options['signatureValue'] = base64_encode(rsa_sign($ohash . $dhash,$channel['channel_prvkey'])); + $options['signatureValue'] = base64_encode(Crypto::sign($ohash . $dhash,$channel['channel_prvkey'])); $signed = array_merge([ - '@context' => [ - ACTIVITYSTREAMS_JSONLD_REV, + '@context' => [ + ACTIVITYSTREAMS_JSONLD_REV, 'https://w3id.org/security/v1' ], ],$options); @@ -88,7 +88,7 @@ class LDSignatures { return ''; jsonld_set_document_loader('jsonld_document_loader'); - + try { $d = jsonld_normalize($data,[ 'algorithm' => 'URDNA2015', 'format' => 'application/nquads' ]); } @@ -117,7 +117,7 @@ class LDSignatures { $precomputed = '.' . base64url_encode($data_type,false) . '.YmFzZTY0dXJs.UlNBLVNIQTI1Ng=='; - $signature = base64url_encode(rsa_sign($data . $precomputed,$channel['channel_prvkey'])); + $signature = base64url_encode(Crypto::sign($data . $precomputed,$channel['channel_prvkey'])); return ([ 'id' => $arr['id'], |