only call proxies for server side encryption
This commit is contained in:
parent
7e3f5492cc
commit
12628be38b
|
@ -35,15 +35,11 @@ class Keymanager {
|
|||
* @return string private key or false
|
||||
*/
|
||||
public static function getPrivateKey() {
|
||||
|
||||
\OC_FileProxy::$enabled = false;
|
||||
|
||||
|
||||
$user = \OCP\User::getUser();
|
||||
$view = new \OC_FilesystemView( '/' . $user . '/' . 'files_encryption' );
|
||||
$result = $view->file_get_contents( '/' . $user.'.private.key' );
|
||||
|
||||
\OC_FileProxy::$enabled = true;
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -80,8 +76,6 @@ class Keymanager {
|
|||
}
|
||||
}
|
||||
|
||||
\OC_FileProxy::$enabled = false;
|
||||
|
||||
$view = new \OC_FilesystemView( '/public-keys/' );
|
||||
|
||||
$keylist = array();
|
||||
|
@ -89,8 +83,6 @@ class Keymanager {
|
|||
foreach ($users as $user) {
|
||||
$keylist['key'.++$count] = $view->file_get_contents($user.'.public.key');
|
||||
}
|
||||
|
||||
\OC_FileProxy::$enabled = true;
|
||||
|
||||
return $keylist;
|
||||
|
||||
|
@ -117,13 +109,9 @@ class Keymanager {
|
|||
$keypath = str_replace('/'.$user.'/files/', '', $keypath);
|
||||
}
|
||||
|
||||
\OC_FileProxy::$enabled = false;
|
||||
|
||||
$view = new \OC_FilesystemView('/'.$user.'/files_encryption/keyfiles/');
|
||||
$result = $view->file_get_contents($keypath.'.key');
|
||||
|
||||
\OC_FileProxy::$enabled = true;
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -134,16 +122,12 @@ class Keymanager {
|
|||
* @return bool true/false
|
||||
*/
|
||||
public static function setPrivateKey($key) {
|
||||
|
||||
\OC_FileProxy::$enabled = false;
|
||||
|
||||
$user = \OCP\User::getUser();
|
||||
$view = new \OC_FilesystemView('/'.$user.'/files_encryption');
|
||||
if (!$view->file_exists('')) $view->mkdir('');
|
||||
$result = $view->file_put_contents($user.'.private.key', $key);
|
||||
|
||||
\OC_FileProxy::$enabled = true;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -156,14 +140,10 @@ class Keymanager {
|
|||
*/
|
||||
public static function setPublicKey($key) {
|
||||
|
||||
\OC_FileProxy::$enabled = false;
|
||||
|
||||
$view = new \OC_FilesystemView('/public-keys');
|
||||
if (!$view->file_exists('')) $view->mkdir('');
|
||||
$result = $view->file_put_contents(\OCP\User::getUser().'.public.key', $key);
|
||||
|
||||
\OC_FileProxy::$enabled = true;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -174,8 +154,7 @@ class Keymanager {
|
|||
* @param string $key
|
||||
* @return bool true/false
|
||||
*/
|
||||
public static function setFileKey( $path, $key, $view = Null, $dbClassName = '\OC_DB', $fileProxyClassName = '\OC_FileProxy') {
|
||||
$fileProxyClassName::$enabled = false;
|
||||
public static function setFileKey( $path, $key, $view = Null, $dbClassName = '\OC_DB') {
|
||||
|
||||
$targetpath = ltrim( $path, '/' );
|
||||
$user = \OCP\User::getUser();
|
||||
|
@ -209,8 +188,6 @@ class Keymanager {
|
|||
|
||||
$result = $view->file_put_contents( '/' . $targetpath . '.key', $key );
|
||||
|
||||
$fileProxyClassName::$enabled = true;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ class Proxy extends \OC_FileProxy {
|
|||
|
||||
if ( is_null( self::$enableEncryption ) ) {
|
||||
|
||||
self::$enableEncryption = ( \OCP\Config::getAppValue( 'files_encryption', 'enable_encryption', 'true' ) == 'true' );
|
||||
self::$enableEncryption = ( \OCP\Config::getAppValue( 'files_encryption', 'enable_encryption', 'true' ) == 'true' && Crypt::mode() == 'server' );
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue