@@ -98,14 +98,14 @@ public function getUserKey($uid, $keyId, $encryptionModuleId) {
9898 */
9999 public function getFileKey ($ path , $ keyId , $ encryptionModuleId ) {
100100 $ realFile = $ this ->util ->stripPartialFileExtension ($ path );
101- $ keyDir = $ this ->getFileKeyDir ($ encryptionModuleId , $ realFile );
101+ $ keyDir = $ this ->util -> getFileKeyDir ($ encryptionModuleId , $ realFile );
102102 $ key = $ this ->getKey ($ keyDir . $ keyId )['key ' ];
103103
104104 if ($ key === '' && $ realFile !== $ path ) {
105105 // Check if the part file has keys and use them, if no normal keys
106106 // exist. This is required to fix copyBetweenStorage() when we
107107 // rename a .part file over storage borders.
108- $ keyDir = $ this ->getFileKeyDir ($ encryptionModuleId , $ path );
108+ $ keyDir = $ this ->util -> getFileKeyDir ($ encryptionModuleId , $ path );
109109 $ key = $ this ->getKey ($ keyDir . $ keyId )['key ' ];
110110 }
111111
@@ -135,7 +135,7 @@ public function setUserKey($uid, $keyId, $key, $encryptionModuleId) {
135135 * @inheritdoc
136136 */
137137 public function setFileKey ($ path , $ keyId , $ key , $ encryptionModuleId ) {
138- $ keyDir = $ this ->getFileKeyDir ($ encryptionModuleId , $ path );
138+ $ keyDir = $ this ->util -> getFileKeyDir ($ encryptionModuleId , $ path );
139139 return $ this ->setKey ($ keyDir . $ keyId , [
140140 'key ' => base64_encode ($ key ),
141141 ]);
@@ -177,15 +177,15 @@ public function deleteUserKey($uid, $keyId, $encryptionModuleId) {
177177 * @inheritdoc
178178 */
179179 public function deleteFileKey ($ path , $ keyId , $ encryptionModuleId ) {
180- $ keyDir = $ this ->getFileKeyDir ($ encryptionModuleId , $ path );
180+ $ keyDir = $ this ->util -> getFileKeyDir ($ encryptionModuleId , $ path );
181181 return !$ this ->view ->file_exists ($ keyDir . $ keyId ) || $ this ->view ->unlink ($ keyDir . $ keyId );
182182 }
183183
184184 /**
185185 * @inheritdoc
186186 */
187187 public function deleteAllFileKeys ($ path ) {
188- $ keyDir = $ this ->getFileKeyDir ('' , $ path );
188+ $ keyDir = $ this ->util -> getFileKeyDir ('' , $ path );
189189 return !$ this ->view ->file_exists ($ keyDir ) || $ this ->view ->deleteAll ($ keyDir );
190190 }
191191
@@ -355,26 +355,6 @@ private function setKey($path, $key) {
355355 return false ;
356356 }
357357
358- /**
359- * get path to key folder for a given file
360- *
361- * @param string $encryptionModuleId
362- * @param string $path path to the file, relative to data/
363- * @return string
364- */
365- private function getFileKeyDir ($ encryptionModuleId , $ path ) {
366- [$ owner , $ filename ] = $ this ->util ->getUidAndFilename ($ path );
367-
368- // in case of system wide mount points the keys are stored directly in the data directory
369- if ($ this ->util ->isSystemWideMountPoint ($ filename , $ owner )) {
370- $ keyPath = $ this ->root_dir . '/ ' . $ this ->keys_base_dir . $ filename . '/ ' ;
371- } else {
372- $ keyPath = $ this ->root_dir . '/ ' . $ owner . $ this ->keys_base_dir . $ filename . '/ ' ;
373- }
374-
375- return Filesystem::normalizePath ($ keyPath . $ encryptionModuleId . '/ ' , false );
376- }
377-
378358 /**
379359 * move keys if a file was renamed
380360 *
0 commit comments