diff options
author | Robin Appelman <robin@icewind.nl> | 2024-01-17 17:47:01 +0100 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2024-01-17 17:47:01 +0100 |
commit | 7bf82fc312acb775bf150ce506d16a05989cd43e (patch) | |
tree | 54548cd8f76e267c720604bb38854effd0082a39 /lib/private/Encryption/Util.php | |
parent | 5de3028f667afb807d1c682238340208e56d6b91 (diff) | |
download | nextcloud-server-7bf82fc312acb775bf150ce506d16a05989cd43e.tar.gz nextcloud-server-7bf82fc312acb775bf150ce506d16a05989cd43e.zip |
add key location to info:file output
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Encryption/Util.php')
-rw-r--r-- | lib/private/Encryption/Util.php | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/private/Encryption/Util.php b/lib/private/Encryption/Util.php index a828483265b..bd27d71c40e 100644 --- a/lib/private/Encryption/Util.php +++ b/lib/private/Encryption/Util.php @@ -385,4 +385,25 @@ class Util { return $result; } + + /** + * get path to key folder for a given file + * + * @param string $encryptionModuleId + * @param string $path path to the file, relative to data/ + * @return string + */ + public function getFileKeyDir(string $encryptionModuleId, string $path): string { + [$owner, $filename] = $this->getUidAndFilename($path); + $root = $this->getKeyStorageRoot(); + + // in case of system-wide mount points the keys are stored directly in the data directory + if ($this->isSystemWideMountPoint($filename, $owner)) { + $keyPath = $root . '/' . '/files_encryption/keys' . $filename . '/'; + } else { + $keyPath = $root . '/' . $owner . '/files_encryption/keys' . $filename . '/'; + } + + return Filesystem::normalizePath($keyPath . $encryptionModuleId . '/', false); + } } |