[Composer] Upgrade to phpseclib version 3

- Create custom Key file format for Salmon Magic key
- Remove obsolete pemToME and MEtoPem Crypto methods
- Remove unused newECKeypair Crypto method
- Switch to constant-time Base64 encode/decode in Base64Url Strings methods
This commit is contained in:
Hypolite Petovan 2022-11-23 13:45:58 -05:00
parent a3fb499735
commit 55640eec87
13 changed files with 241 additions and 173 deletions

View file

@ -142,14 +142,9 @@ class Salmon extends \Friendica\BaseModule
throw new HTTPException\BadRequestException();
}
$key_info = explode('.', $key);
$this->logger->info('Key details', ['info' => $key]);
$m = Strings::base64UrlDecode($key_info[1]);
$e = Strings::base64UrlDecode($key_info[2]);
$this->logger->info('Key details', ['info' => $key_info]);
$pubkey = Crypto::meToPem($m, $e);
$pubkey = SalmonProtocol::magicKeyToPem($key);
// We should have everything we need now. Let's see if it verifies.