* @note This method should never be called for users using client side encryption\r
*/\r
public static function login( $params ) {\r
- \r
- $view = new \OC_FilesystemView( '/' );\r
-\r
- $util = new Util( $view, $params['uid'] );\r
- \r
- if ( ! $util->ready() ) {\r
- \r
- \OC_Log::write( 'Encryption library', 'User account "' . $params['uid'] . '" is not ready for encryption; configuration started', \OC_Log::DEBUG );\r
- \r
- return $util->setupServerSide( $params['password'] );\r
+ \r
+ \OC\Files\Filesystem::init( $params['uid'] . '/' . 'files' . '/' );\r
+ \r
+ $view = new \OC_FilesystemView( '/' );\r
\r
- }\r
+ $util = new Util( $view, $params['uid'] );\r
\r
- \OC_FileProxy::$enabled = false;\r
- \r
- $encryptedKey = Keymanager::getPrivateKey( $view, $params['uid'] );\r
- \r
- \OC_FileProxy::$enabled = true;\r
+ if ( ! $util->ready() ) {\r
\r
- $privateKey = Crypt::symmetricDecryptFileContent( $encryptedKey, $params['password'] );\r
+ \OC_Log::write( 'Encryption library', 'User account "' . $params['uid'] . '" is not ready for encryption; configuration started', \OC_Log::DEBUG );\r
\r
- $session = new Session();\r
- \r
- $session->setPrivateKey( $privateKey, $params['uid'] );\r
- \r
- $view1 = new \OC_FilesystemView( '/' . $params['uid'] );\r
- \r
- // Set legacy encryption key if it exists, to support \r
- // depreciated encryption system\r
- if ( \r
- $view1->file_exists( 'encryption.key' )\r
- && $encLegacyKey = $view1->file_get_contents( 'encryption.key' ) \r
- ) {\r
- \r
- $plainLegacyKey = Crypt::legacyDecrypt( $encLegacyKey, $params['password'] );\r
- \r
- $session->setLegacyKey( $plainLegacyKey );\r
- \r
- }\r
- \r
- $publicKey = Keymanager::getPublicKey( $view, $params['uid'] );\r
- \r
- // Encrypt existing user files:\r
- // This serves to upgrade old versions of the encryption\r
- // app (see appinfo/spec.txt)\r
- if ( \r
- $util->encryptAll( $publicKey, '/' . $params['uid'] . '/' . 'files', $session->getLegacyKey(), $params['password'] )\r
- ) {\r
- \r
- \OC_Log::write( \r
- 'Encryption library', 'Encryption of existing files belonging to "' . $params['uid'] . '" started at login'\r
- , \OC_Log::INFO \r
- );\r
+ return $util->setupServerSide( $params['password'] );\r
+\r
+ }\r
+ \r
+ \OC_FileProxy::$enabled = false;\r
+ \r
+ $encryptedKey = Keymanager::getPrivateKey( $view, $params['uid'] );\r
+ \r
+ \OC_FileProxy::$enabled = true;\r
+ \r
+ $privateKey = Crypt::symmetricDecryptFileContent( $encryptedKey, $params['password'] );\r
+ \r
+ $session = new Session();\r
+ \r
+ $session->setPrivateKey( $privateKey, $params['uid'] );\r
+ \r
+ $view1 = new \OC_FilesystemView( '/' . $params['uid'] );\r
+ \r
+ // Set legacy encryption key if it exists, to support \r
+ // depreciated encryption system\r
+ if ( \r
+ $view1->file_exists( 'encryption.key' )\r
+ && $encLegacyKey = $view1->file_get_contents( 'encryption.key' ) \r
+ ) {\r
+ \r
+ $plainLegacyKey = Crypt::legacyDecrypt( $encLegacyKey, $params['password'] );\r
\r
- }\r
+ $session->setLegacyKey( $plainLegacyKey );\r
+ \r
+ }\r
+ \r
+ $publicKey = Keymanager::getPublicKey( $view, $params['uid'] );\r
+ \r
+ // Encrypt existing user files:\r
+ // This serves to upgrade old versions of the encryption\r
+ // app (see appinfo/spec.txt)\r
+ if ( \r
+ $util->encryptAll( $publicKey, '/' . $params['uid'] . '/' . 'files', $session->getLegacyKey(), $params['password'] )\r
+ ) {\r
+ \r
+ \OC_Log::write( \r
+ 'Encryption library', 'Encryption of existing files belonging to "' . $params['uid'] . '" started at login'\r
+ , \OC_Log::INFO \r
+ );\r
+ \r
+ }\r
\r
return true;\r
\r