mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-07-07 17:08:48 +00:00
[securemail] Upgrade singpolyma/openpgp to version 0.6.0
- Add missing use statement in SecureTestEmail - Address https://github.com/friendica/friendica/issues/12011#issuecomment-1321196332 - phpseclib version 3 dependency is implied from the core so it is removed from the addon
This commit is contained in:
parent
30329df0dd
commit
c18e0dc66a
60 changed files with 660 additions and 36426 deletions
24
securemail/vendor/singpolyma/openpgp-php/lib/openpgp_sodium.php
vendored
Normal file
24
securemail/vendor/singpolyma/openpgp-php/lib/openpgp_sodium.php
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
function sodium_make_verifier($pk) {
|
||||
return function($m, $s) use ($pk) {
|
||||
if($pk instanceof OpenPGP_Message) {
|
||||
foreach($pk as $p) {
|
||||
if($p instanceof OpenPGP_PublicKeyPacket) {
|
||||
if(substr($p->fingerprint, strlen($s->issuer())*-1) == $s->issuer()) {
|
||||
$pk = $p;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($pk->algorithm != 22) throw new Exception("Only EdDSA supported");
|
||||
if (bin2hex($pk->key['oid']) != '2b06010401da470f01') throw new Exception("Only ed25519 supported");
|
||||
return sodium_crypto_sign_verify_detached(
|
||||
implode($s->data),
|
||||
hash($s->hash_algorithm_name(), $m, true),
|
||||
substr($pk->key['p'], 1)
|
||||
);
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue