summaryrefslogtreecommitdiffstats
path: root/apps/files_external
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@owncloud.com>2015-08-03 06:39:53 +0200
committerAndreas Fischer <bantu@owncloud.com>2015-08-03 09:43:45 +0200
commit3b803db6d815a6d015d5fa013c8147d66a559973 (patch)
treea57c944135af4bb3390c1db1806937d320b4b3cd /apps/files_external
parent27bfab37bc2cdc4cc4e3de891c2ecfa7d71b90fd (diff)
downloadnextcloud-server-3b803db6d815a6d015d5fa013c8147d66a559973.tar.gz
nextcloud-server-3b803db6d815a6d015d5fa013c8147d66a559973.zip
Update phpseclib to 2.0
Diffstat (limited to 'apps/files_external')
-rw-r--r--apps/files_external/controller/ajaxcontroller.php5
-rw-r--r--apps/files_external/lib/config.php7
-rw-r--r--apps/files_external/lib/sftp.php16
-rw-r--r--apps/files_external/lib/sftp_key.php15
4 files changed, 23 insertions, 20 deletions
diff --git a/apps/files_external/controller/ajaxcontroller.php b/apps/files_external/controller/ajaxcontroller.php
index 6225cd0b619..cb2de432286 100644
--- a/apps/files_external/controller/ajaxcontroller.php
+++ b/apps/files_external/controller/ajaxcontroller.php
@@ -25,6 +25,7 @@ namespace OCA\Files_External\Controller;
use OCP\AppFramework\Controller;
use OCP\IRequest;
use OCP\AppFramework\Http\JSONResponse;
+use phpseclib\Crypt\RSA;
class AjaxController extends Controller {
public function __construct($appName, IRequest $request) {
@@ -32,8 +33,8 @@ class AjaxController extends Controller {
}
private function generateSshKeys() {
- $rsa = new \Crypt_RSA();
- $rsa->setPublicKeyFormat(CRYPT_RSA_PUBLIC_FORMAT_OPENSSH);
+ $rsa = new RSA();
+ $rsa->setPublicKeyFormat(RSA::PUBLIC_FORMAT_OPENSSH);
$rsa->setPassword(\OC::$server->getConfig()->getSystemValue('secret', ''));
$key = $rsa->createKey();
diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php
index 5dc6d06ae06..91e1aa7d509 100644
--- a/apps/files_external/lib/config.php
+++ b/apps/files_external/lib/config.php
@@ -31,6 +31,8 @@
*
*/
+use phpseclib\Crypt\AES;
+
/**
* Class to configure mount.json globally and for users
*/
@@ -895,10 +897,7 @@ class OC_Mount_Config {
* Returns the encryption cipher
*/
private static function getCipher() {
- if (!class_exists('Crypt_AES', false)) {
- include('Crypt/AES.php');
- }
- $cipher = new Crypt_AES(CRYPT_AES_MODE_CBC);
+ $cipher = new AES(AES::MODE_CBC);
$cipher->setKey(\OC::$server->getConfig()->getSystemValue('passwordsalt', null));
return $cipher;
}
diff --git a/apps/files_external/lib/sftp.php b/apps/files_external/lib/sftp.php
index cbe090311a9..03ece9cb9dd 100644
--- a/apps/files_external/lib/sftp.php
+++ b/apps/files_external/lib/sftp.php
@@ -30,8 +30,12 @@
*/
namespace OC\Files\Storage;
+use phpseclib\Net\RSA;
+use phpseclib\Net\SFTP;
+use phpseclib\Net\SFTP\Stream;
+
/**
-* Uses phpseclib's Net_SFTP class and the Net_SFTP_Stream stream wrapper to
+* Uses phpseclib's Net\SFTP class and the Net\SFTP\Stream stream wrapper to
* provide access to SFTP servers.
*/
class SFTP extends \OC\Files\Storage\Common {
@@ -42,7 +46,7 @@ class SFTP extends \OC\Files\Storage\Common {
private $port = 22;
/**
- * @var \Net_SFTP
+ * @var SFTP
*/
protected $client;
@@ -51,10 +55,10 @@ class SFTP extends \OC\Files\Storage\Common {
*/
public function __construct($params) {
// Register sftp://
- \Net_SFTP_Stream::register();
+ Stream::register();
$this->host = $params['host'];
-
+
//deals with sftp://server example
$proto = strpos($this->host, '://');
if ($proto != false) {
@@ -87,7 +91,7 @@ class SFTP extends \OC\Files\Storage\Common {
/**
* Returns the connection.
*
- * @return \Net_SFTP connected client instance
+ * @return SFTP connected client instance
* @throws \Exception when the connection failed
*/
public function getConnection() {
@@ -96,7 +100,7 @@ class SFTP extends \OC\Files\Storage\Common {
}
$hostKeys = $this->readHostKeys();
- $this->client = new \Net_SFTP($this->host, $this->port);
+ $this->client = new SFTP($this->host, $this->port);
// The SSH Host Key MUST be verified before login().
$currentHostKey = $this->client->getServerPublicHostKey();
diff --git a/apps/files_external/lib/sftp_key.php b/apps/files_external/lib/sftp_key.php
index 1bcea6bc96d..06771d57d22 100644
--- a/apps/files_external/lib/sftp_key.php
+++ b/apps/files_external/lib/sftp_key.php
@@ -22,10 +22,9 @@
*/
namespace OC\Files\Storage;
-/**
-* Uses phpseclib's Net_SFTP class and the Net_SFTP_Stream stream wrapper to
-* provide access to SFTP servers.
-*/
+use phpseclib\Crypt\RSA;
+use phpseclib\Net\SFTP;
+
class SFTP_Key extends \OC\Files\Storage\SFTP {
private $publicKey;
private $privateKey;
@@ -39,7 +38,7 @@ class SFTP_Key extends \OC\Files\Storage\SFTP {
/**
* Returns the connection.
*
- * @return \Net_SFTP connected client instance
+ * @return SFTP connected client instance
* @throws \Exception when the connection failed
*/
public function getConnection() {
@@ -48,7 +47,7 @@ class SFTP_Key extends \OC\Files\Storage\SFTP {
}
$hostKeys = $this->readHostKeys();
- $this->client = new \Net_SFTP($this->getHost());
+ $this->client = new SFTP($this->getHost());
// The SSH Host Key MUST be verified before login().
$currentHostKey = $this->client->getServerPublicHostKey();
@@ -74,10 +73,10 @@ class SFTP_Key extends \OC\Files\Storage\SFTP {
/**
* Returns the private key to be used for authentication to the remote server.
*
- * @return \Crypt_RSA instance or null in case of a failure to load the key.
+ * @return RSA instance or null in case of a failure to load the key.
*/
private function getPrivateKey() {
- $key = new \Crypt_RSA();
+ $key = new RSA();
$key->setPassword(\OC::$server->getConfig()->getSystemValue('secret', ''));
if (!$key->loadKey($this->privateKey)) {
// Should this exception rather than return null?