Merge branch 'files_encryption' of github.com:owncloud/core into files_encryption
This commit is contained in:
commit
1f5ed65b12
|
@ -26,26 +26,27 @@ OCA\Encryption\Helper::registerFilesystemHooks();
|
|||
|
||||
stream_wrapper_register( 'crypt', 'OCA\Encryption\Stream' );
|
||||
|
||||
$view = new OC_FilesystemView( '/' );
|
||||
// check if we are logged in
|
||||
if (OCP\User::isLoggedIn()) {
|
||||
$view = new OC_FilesystemView('/');
|
||||
$session = new \OCA\Encryption\Session($view);
|
||||
|
||||
//$session = new \OCA\Encryption\Session( $view );
|
||||
//
|
||||
//if (
|
||||
// ! $session->getPrivateKey( \OCP\USER::getUser() )
|
||||
// && OCP\User::isLoggedIn()
|
||||
// && OCA\Encryption\Crypt::mode() == 'server'
|
||||
//) {
|
||||
//
|
||||
// // Force the user to log-in again if the encryption key isn't unlocked
|
||||
// // (happens when a user is logged in before the encryption app is
|
||||
// // enabled)
|
||||
// OCP\User::logout();
|
||||
//
|
||||
// header( "Location: " . OC::$WEBROOT.'/' );
|
||||
//
|
||||
// exit();
|
||||
//
|
||||
//}
|
||||
// check if user has a private key
|
||||
if (
|
||||
!$session->getPrivateKey(\OCP\USER::getUser())
|
||||
&& OCA\Encryption\Crypt::mode() === 'server'
|
||||
) {
|
||||
|
||||
// Force the user to log-in again if the encryption key isn't unlocked
|
||||
// (happens when a user is logged in before the encryption app is
|
||||
// enabled)
|
||||
OCP\User::logout();
|
||||
|
||||
header("Location: " . OC::$WEBROOT . '/');
|
||||
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
// Register settings scripts
|
||||
OCP\App::registerAdmin( 'files_encryption', 'settings-admin' );
|
||||
|
|
|
@ -53,14 +53,9 @@ class Hooks {
|
|||
return false;
|
||||
}
|
||||
|
||||
\OC_FileProxy::$enabled = false;
|
||||
|
||||
$encryptedKey = Keymanager::getPrivateKey( $view, $params['uid'] );
|
||||
|
||||
\OC_FileProxy::$enabled = true;
|
||||
|
||||
//$privateKey = Crypt::symmetricDecryptFileContent( $encryptedKey, $params['password'] );
|
||||
$privateKey = Crypt::symmetricDecryptFileContent( $encryptedKey, "helloworld" );
|
||||
$privateKey = Crypt::symmetricDecryptFileContent( $encryptedKey, $params['password'] );
|
||||
|
||||
$session = new Session( $view );
|
||||
|
||||
|
@ -87,12 +82,8 @@ class Hooks {
|
|||
|
||||
}
|
||||
|
||||
\OC_FileProxy::$enabled = false;
|
||||
|
||||
$publicKey = Keymanager::getPublicKey( $view, $params['uid'] );
|
||||
|
||||
\OC_FileProxy::$enabled = false;
|
||||
|
||||
// Encrypt existing user files:
|
||||
// This serves to upgrade old versions of the encryption
|
||||
// app (see appinfo/spec.txt)
|
||||
|
|
Loading…
Reference in New Issue