-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
feat(deps): Upgrade phpseclib to v3 #48183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
f25ae54 to
d9d7046
Compare
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
d9d7046 to
25d13a4
Compare
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
c66f090 to
9ca9c89
Compare
|
Problem with this: |
|
Perhaps |
Signed-off-by: Josh <josh.t.richards@gmail.com>
| $auth->setPassword($this->config->getSystemValue('secret', '')); | ||
| if (!$auth->loadKey($storage->getBackendOption('private_key'))) { | ||
| $auth = new RSA\PrivateKey(); | ||
| $auth->withPassword($this->config->getSystemValue('secret', '')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| $auth->withPassword($this->config->getSystemValue('secret', '')); | |
| $auth = $auth->withPassword($this->config->getSystemValue('secret', '')); |
v3 is immutable
| // Add fallback routine for a time where secret was not enforced to be exists | ||
| $auth->setPassword(''); | ||
| if (!$auth->loadKey($storage->getBackendOption('private_key'))) { | ||
| $auth->withPassword(''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| $auth->withPassword(''); | |
| $auth = $auth->withPassword(''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
L220 for v3
private static function getCipher() {
$cipher = new AES('cbc');
Updated RSA key loading to use PSS padding and options. Signed-off-by: Josh <josh.t.richards@gmail.com>
| $auth->setPassword($this->config->getSystemValue('secret', '')); | ||
| if (!$auth->loadKey($storage->getBackendOption('private_key'))) { | ||
| try { | ||
| $auth = RSACrypt::loadPrivateKey( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be nice to support EC / DSA keys as well. One can do that thusly:
$auth = \phpseclib3\Crypt\PublicKeyLoader::load(
$storage->getBackendOption('private_key'),
$this->config->getSystemValue('secret', '');
);
if (!$auth instanceof \phpseclib3\Crypt\Common\PrivateKey) {
throw new \Exception('A private key needs to be loaded - not a ' . $auth::class . ' key');
}I suppose it might also be worthwhile to realize that if no key can be detected (eg. you try to load a PHP file as a key) then a \phpseclib3\Exception\NoKeyLoadedException will be thrown.
That said, if more than just RSA keys are going to be supported then renaming the class would prob be appropriate as well.
Summary
TODO
Checklist