Skip to content
Snippets Groups Projects
Commit 8daceaad authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms Committed by David Siegfried
Browse files

update phpseclib/phpseclib to 3.0.19, fixes #2478

Closes #2478

Merge request studip/studip!1672
parent 9e1ef2c6
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@
namespace Studip\Cli\Commands\OAuth2;
use phpseclib\Crypt\RSA;
use phpseclib3\Crypt\RSA;
use Studip\OAuth2\Container;
use Studip\OAuth2\KeyInformation;
use Studip\OAuth2\SetupInformation;
......@@ -46,7 +46,7 @@ class Keys extends Command
$this->storeKeyContentsToFile($encryptionKey, $this->generateEncryptionKey());
$keys = (new RSA())->createKey(4096);
$keys = RSA::createKey(4096);
$this->storeKeyContentsToFile($publicKey, $keys['publickey']);
$this->storeKeyContentsToFile($privateKey, $keys['privatekey']);
......
......@@ -35,7 +35,7 @@
"phpxmlrpc/extras": "^0.6.2",
"algo26-matthias/idna-convert": "^3.0",
"caxy/php-htmldiff": "^0.1.9",
"phpseclib/phpseclib": "^2.0",
"phpseclib/phpseclib": "^3",
"ext-gd": "*",
"ext-gettext": "*",
"ext-pdo_mysql": "*",
......
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "e5a2c38d2da4fc895b77b9575107b066",
"content-hash": "b7e85080cec3bd84bb509a9b89bdc107",
"packages": [
{
"name": "algo26-matthias/idna-convert",
......@@ -2013,32 +2013,32 @@
},
{
"name": "phpseclib/phpseclib",
"version": "2.0.38",
"version": "3.0.19",
"source": {
"type": "git",
"url": "https://github.com/phpseclib/phpseclib.git",
"reference": "b03536539f43a4f9aa33c4f0b2f3a1c752088fcd"
"reference": "cc181005cf548bfd8a4896383bb825d859259f95"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/b03536539f43a4f9aa33c4f0b2f3a1c752088fcd",
"reference": "b03536539f43a4f9aa33c4f0b2f3a1c752088fcd",
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/cc181005cf548bfd8a4896383bb825d859259f95",
"reference": "cc181005cf548bfd8a4896383bb825d859259f95",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
"paragonie/constant_time_encoding": "^1|^2",
"paragonie/random_compat": "^1.4|^2.0|^9.99.99",
"php": ">=5.6.1"
},
"require-dev": {
"phing/phing": "~2.7",
"phpunit/phpunit": "^4.8.35|^5.7|^6.0|^9.4",
"squizlabs/php_codesniffer": "~2.0"
"phpunit/phpunit": "*"
},
"suggest": {
"ext-dom": "Install the DOM extension to load XML formatted public keys.",
"ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.",
"ext-libsodium": "SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.",
"ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.",
"ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations.",
"ext-xml": "Install the XML extension to load XML formatted public keys."
"ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations."
},
"type": "library",
"autoload": {
......@@ -2046,7 +2046,7 @@
"phpseclib/bootstrap.php"
],
"psr-4": {
"phpseclib\\": "phpseclib/"
"phpseclib3\\": "phpseclib/"
}
},
"notification-url": "https://packagist.org/downloads/",
......@@ -2103,7 +2103,7 @@
],
"support": {
"issues": "https://github.com/phpseclib/phpseclib/issues",
"source": "https://github.com/phpseclib/phpseclib/tree/2.0.38"
"source": "https://github.com/phpseclib/phpseclib/tree/3.0.19"
},
"funding": [
{
......@@ -2119,7 +2119,7 @@
"type": "tidelift"
}
],
"time": "2022-09-02T17:04:26+00:00"
"time": "2023-03-05T17:13:09+00:00"
},
{
"name": "phpxmlrpc/extras",
......
<?php
use phpseclib3\Crypt\RSA;
abstract class OERIdentity extends SimpleORMap
{
/**
......@@ -14,16 +16,12 @@ abstract class OERIdentity extends SimpleORMap
public function createSignature($text)
{
$rsa = new \phpseclib\Crypt\RSA();
$rsa->loadKey($this['private_key']);
return $rsa->sign($text);
return RSA::loadPrivateKey($this['private_key'])->sign($text);
}
public function verifySignature($text, $signature)
{
$rsa = new \phpseclib\Crypt\RSA();
$rsa->loadKey($this['public_key']);
return $rsa->verify($text, $signature);
return RSA::loadPublicKey($this['public_key'])->verify($text, $signature);
}
public function cbCreateKeysIfNecessary()
......@@ -33,9 +31,9 @@ abstract class OERIdentity extends SimpleORMap
}
}
protected function createKeys() {
$rsa = new \phpseclib\Crypt\RSA();
$keypair = $rsa->createKey(4096);
protected function createKeys()
{
$keypair = RSA::createKey(4096);
$this['private_key'] = preg_replace("/\r/", "", $keypair['privatekey']);
$this['public_key'] = preg_replace("/\r/", "", $keypair['publickey']);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment