Applied fix from kalassico for "Chiper text must be a string" bug (http://forum.owncloud.org/viewtopic.php?f=3&t=2586&p=5094)

This commit is contained in:
Sam Tuke 2012-05-31 12:25:07 +01:00
parent 3b36a9b704
commit e93bb5135d
1 changed files with 17 additions and 10 deletions

View File

@ -43,16 +43,23 @@ class OC_Crypt {
self::init($params['uid'],$params['password']); self::init($params['uid'],$params['password']);
} }
public static function init($login,$password) { public static function init($login,$password) {
$view=new OC_FilesystemView('/'.$login); $view1=new OC_FilesystemView('/');
OC_FileProxy::$enabled=false; if(!$view1->file_exists('/'.$login)){
if(!$view->file_exists('/encryption.key')){// does key exist? $view1->mkdir('/'.$login);
OC_Crypt::createkey($login,$password); }
}
$key=$view->file_get_contents('/encryption.key'); $view=new OC_FilesystemView('/'.$login);
OC_FileProxy::$enabled=true;
$_SESSION['enckey']=OC_Crypt::decrypt($key, $password); OC_FileProxy::$enabled=false;
} if(!$view->file_exists('/encryption.key')){// does key exist?
OC_Crypt::createkey($login,$password);
}
$key=$view->file_get_contents('/encryption.key');
OC_FileProxy::$enabled=true;
$_SESSION['enckey']=OC_Crypt::decrypt($key, $password);
}
/** /**
* get the blowfish encryption handeler for a key * get the blowfish encryption handeler for a key