-
-
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?
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -11,7 +11,7 @@ | |||||
| use OCP\IConfig; | ||||||
| use OCP\IL10N; | ||||||
| use OCP\IUser; | ||||||
| use phpseclib\Crypt\RSA as RSACrypt; | ||||||
| use phpseclib3\Crypt\RSA; | ||||||
|
|
||||||
| /** | ||||||
| * RSA public key authentication | ||||||
|
|
@@ -39,12 +39,12 @@ public function __construct( | |||||
| * @return void | ||||||
| */ | ||||||
| public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null) { | ||||||
| $auth = new RSACrypt(); | ||||||
| $auth->setPassword($this->config->getSystemValue('secret', '')); | ||||||
| if (!$auth->loadKey($storage->getBackendOption('private_key'))) { | ||||||
| $auth = new RSA\PrivateKey(); | ||||||
| $auth->withPassword($this->config->getSystemValue('secret', '')); | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
v3 is immutable |
||||||
| if (!$auth->loadPrivateKey($storage->getBackendOption('private_key'))) { | ||||||
| // 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(''); | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| if (!$auth->loadPrivateKey($storage->getBackendOption('private_key'))) { | ||||||
| throw new \RuntimeException('unable to load private key'); | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. L220 for v3 |
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:
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\NoKeyLoadedExceptionwill 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.