コード例 #1
0
ファイル: session.php プロジェクト: hjimmy/owncloud
 /**
  * @brief Gets user or public share private key from session
  * @returns string $privateKey The user's plaintext private key
  *
  */
 public function getPrivateKey()
 {
     // return the public share private key if this is a public access
     if (\OCA\Encryption\Helper::isPublicAccess()) {
         return $this->getPublicSharePrivateKey();
     } else {
         if (!is_null(\OC::$session->get('privateKey'))) {
             return \OC::$session->get('privateKey');
         } else {
             return false;
         }
     }
 }
コード例 #2
0
ファイル: util.php プロジェクト: Combustible/core
 /**
  * @param \OC\Files\View $view
  * @param string $userId
  * @param bool $client
  */
 public function __construct($view, $userId, $client = false)
 {
     $this->view = $view;
     $this->client = $client;
     $this->userId = $userId;
     $appConfig = \OC::$server->getAppConfig();
     $this->publicShareKeyId = $appConfig->getValue('files_encryption', 'publicShareKeyId');
     $this->recoveryKeyId = $appConfig->getValue('files_encryption', 'recoveryKeyId');
     $this->userDir = '/' . $this->userId;
     $this->fileFolderName = 'files';
     $this->userFilesDir = '/' . $userId . '/' . $this->fileFolderName;
     // TODO: Does this need to be user configurable?
     $this->publicKeyDir = '/' . 'public-keys';
     $this->encryptionDir = '/' . $this->userId . '/' . 'files_encryption';
     $this->keyfilesPath = $this->encryptionDir . '/' . 'keyfiles';
     $this->shareKeysPath = $this->encryptionDir . '/' . 'share-keys';
     $this->publicKeyPath = $this->publicKeyDir . '/' . $this->userId . '.public.key';
     // e.g. data/public-keys/admin.public.key
     $this->privateKeyPath = $this->encryptionDir . '/' . $this->userId . '.private.key';
     // e.g. data/admin/admin.private.key
     // make sure that the owners home is mounted
     \OC\Files\Filesystem::initMountPoints($userId);
     if (\OCA\Encryption\Helper::isPublicAccess()) {
         $this->keyId = $this->publicShareKeyId;
         $this->isPublic = true;
     } else {
         $this->keyId = $this->userId;
         $this->isPublic = false;
     }
 }
コード例 #3
0
ファイル: session.php プロジェクト: CDN-Sparks/owncloud
 /**
  * @brief Gets user or public share private key from session
  * @returns string $privateKey The user's plaintext private key
  *
  */
 public function getPrivateKey()
 {
     // return the public share private key if this is a public access
     if (\OCA\Encryption\Helper::isPublicAccess()) {
         return $this->getPublicSharePrivateKey();
     } else {
         if (isset($_SESSION['privateKey']) && !empty($_SESSION['privateKey'])) {
             return $_SESSION['privateKey'];
         } else {
             return false;
         }
     }
 }
コード例 #4
0
ファイル: util.php プロジェクト: CDN-Sparks/owncloud
 /**
  * @param \OC_FilesystemView $view
  * @param $userId
  * @param bool $client
  */
 public function __construct(\OC_FilesystemView $view, $userId, $client = false)
 {
     $this->view = $view;
     $this->userId = $userId;
     $this->client = $client;
     $this->isPublic = false;
     $this->publicShareKeyId = \OC_Appconfig::getValue('files_encryption', 'publicShareKeyId');
     $this->recoveryKeyId = \OC_Appconfig::getValue('files_encryption', 'recoveryKeyId');
     // if we are anonymous/public
     if (\OCA\Encryption\Helper::isPublicAccess()) {
         $this->userId = $this->publicShareKeyId;
         // only handle for files_sharing app
         if (isset($GLOBALS['app']) && $GLOBALS['app'] === 'files_sharing') {
             $this->userDir = '/' . $GLOBALS['fileOwner'];
             $this->fileFolderName = 'files';
             $this->userFilesDir = '/' . $GLOBALS['fileOwner'] . '/' . $this->fileFolderName;
             // TODO: Does this need to be user configurable?
             $this->publicKeyDir = '/' . 'public-keys';
             $this->encryptionDir = '/' . $GLOBALS['fileOwner'] . '/' . 'files_encryption';
             $this->keyfilesPath = $this->encryptionDir . '/' . 'keyfiles';
             $this->shareKeysPath = $this->encryptionDir . '/' . 'share-keys';
             $this->publicKeyPath = $this->publicKeyDir . '/' . $this->userId . '.public.key';
             // e.g. data/public-keys/admin.public.key
             $this->privateKeyPath = '/owncloud_private_key/' . $this->userId . '.private.key';
             // e.g. data/admin/admin.private.key
             $this->isPublic = true;
         }
     } else {
         $this->userDir = '/' . $this->userId;
         $this->fileFolderName = 'files';
         $this->userFilesDir = '/' . $this->userId . '/' . $this->fileFolderName;
         // TODO: Does this need to be user configurable?
         $this->publicKeyDir = '/' . 'public-keys';
         $this->encryptionDir = '/' . $this->userId . '/' . 'files_encryption';
         $this->keyfilesPath = $this->encryptionDir . '/' . 'keyfiles';
         $this->shareKeysPath = $this->encryptionDir . '/' . 'share-keys';
         $this->publicKeyPath = $this->publicKeyDir . '/' . $this->userId . '.public.key';
         // e.g. data/public-keys/admin.public.key
         $this->privateKeyPath = $this->encryptionDir . '/' . $this->userId . '.private.key';
         // e.g. data/admin/admin.private.key
     }
 }