Development snapshot

This commit is contained in:
Sam Tuke 2013-02-06 15:08:36 +00:00
parent 16a5ace434
commit 6870add18f
3 changed files with 5 additions and 21 deletions

View File

@ -107,14 +107,16 @@ class Hooks {
* @param array $params keys: uid, password
*/
public static function setPassphrase( $params ) {
trigger_error("HOSH");
// Only attempt to change passphrase if server-side encryption
// is in use (client-side encryption does not have access to
// the necessary keys)
if ( Crypt::mode() == 'server' ) {
$session = new Session();
// Get existing decrypted private key
$privateKey = $_SESSION['privateKey'];
$privateKey = $session->getPrivateKey();
// Encrypt private key with new user pwd as passphrase
$encryptedPrivateKey = Crypt::symmetricEncryptFileContent( $privateKey, $params['password'] );

View File

@ -45,24 +45,6 @@ class Crypt {
* @return string 'client' or 'server'
*/
public static function mode( $user = null ) {
// $mode = \OC_Appconfig::getValue( 'files_encryption', 'mode', 'none' );
//
// if ( $mode == 'user') {
// if ( !$user ) {
// $user = \OCP\User::getUser();
// }
// $mode = 'none';
// if ( $user ) {
// $query = \OC_DB::prepare( "SELECT mode FROM *PREFIX*encryption WHERE uid = ?" );
// $result = $query->execute(array($user));
// if ($row = $result->fetchRow()){
// $mode = $row['mode'];
// }
// }
// }
//
// return $mode;
return 'server';

View File

@ -206,7 +206,7 @@ class Keymanager {
* as no encryption takes place here
*/
public static function setPrivateKey( $key ) {
trigger_error("MOSH");
$user = \OCP\User::getUser();
$view = new \OC_FilesystemView( '/' . $user . '/files_encryption' );