diff options
Diffstat (limited to 'apps/files_external/controller/ajaxcontroller.php')
-rw-r--r-- | apps/files_external/controller/ajaxcontroller.php | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/apps/files_external/controller/ajaxcontroller.php b/apps/files_external/controller/ajaxcontroller.php index cb2de432286..c285cd34e70 100644 --- a/apps/files_external/controller/ajaxcontroller.php +++ b/apps/files_external/controller/ajaxcontroller.php @@ -25,19 +25,19 @@ namespace OCA\Files_External\Controller; use OCP\AppFramework\Controller; use OCP\IRequest; use OCP\AppFramework\Http\JSONResponse; -use phpseclib\Crypt\RSA; +use OCA\Files_External\Lib\Auth\PublicKey\RSA; class AjaxController extends Controller { - public function __construct($appName, IRequest $request) { + /** @var RSA */ + private $rsaMechanism; + + public function __construct($appName, IRequest $request, RSA $rsaMechanism) { parent::__construct($appName, $request); + $this->rsaMechanism = $rsaMechanism; } private function generateSshKeys() { - $rsa = new RSA(); - $rsa->setPublicKeyFormat(RSA::PUBLIC_FORMAT_OPENSSH); - $rsa->setPassword(\OC::$server->getConfig()->getSystemValue('secret', '')); - - $key = $rsa->createKey(); + $key = $this->rsaMechanism->createKey(); // Replace the placeholder label with a more meaningful one $key['publicKey'] = str_replace('phpseclib-generated-key', gethostname(), $key['publickey']); |