Util

class OC\Encryption\Util
Source:lib/private/Encryption/Util.php#40

Constants

HEADER_START = HBEGIN
Source:lib/private/Encryption/Util.php#41
HEADER_END = HEND
Source:lib/private/Encryption/Util.php#42
HEADER_PADDING_CHAR = -
Source:lib/private/Encryption/Util.php#43
HEADER_ENCRYPTION_MODULE_KEY = oc_encryption_module
Source:lib/private/Encryption/Util.php#45

Properties

protected static property OC\Encryption\Util::$headerSize
block size will always be 8192 for a PHP stream
Source:lib/private/Encryption/Util.php#52
See:https://bugs.php.net/bug.php?id=21641
Type:int
protected static property OC\Encryption\Util::$blockSize
block size will always be 8192 for a PHP stream
Source:lib/private/Encryption/Util.php#59
See:https://bugs.php.net/bug.php?id=21641
Type:int
protected static property OC\Encryption\Util::$rootView
Source:lib/private/Encryption/Util.php#62
Type:\OC\Files\View
protected static property OC\Encryption\Util::$ocHeaderKeys
Source:lib/private/Encryption/Util.php#65
Type:array
protected static property OC\Encryption\Util::$userManager
Source:lib/private/Encryption/Util.php#68
Type:\OC\User\Manager
protected static property OC\Encryption\Util::$config
Source:lib/private/Encryption/Util.php#71
Type:\OCP\IConfig
protected static property OC\Encryption\Util::$excludedPaths
Source:lib/private/Encryption/Util.php#74
Type:array paths excluded from encryption
protected static property OC\Encryption\Util::$groupManager
Source:lib/private/Encryption/Util.php#77
Type:\OC\Group\Manager

Methods

public OC\Encryption\Util::__construct($rootView, $userManager, $groupManager, $config)
Source:

lib/private/Encryption/Util.php#86

Parameters:
public OC\Encryption\Util::getEncryptionModuleId($header=null)
read encryption module ID from header
Source:

lib/private/Encryption/Util.php#112

Parameters:
  • $header (array)
Returns:

string

Throws:

\OC\Encryption\Exceptions\ModuleDoesNotExistsException

public OC\Encryption\Util::createHeader($headerData, $encryptionModule)
create header for encrypted file
Source:

lib/private/Encryption/Util.php#140

Parameters:
Returns:

string

Throws:

\OC\Encryption\Exceptions\EncryptionHeaderToLargeException if header has to many arguments

Throws:

\OC\Encryption\Exceptions\EncryptionHeaderKeyExistsException if header key is already in use

Throws:

\OC\Encryption\Exceptions\EncryptionHeaderToLargeException if header has to many arguments

Throws:

\OC\Encryption\Exceptions\EncryptionHeaderKeyExistsException if header key is already in use

public OC\Encryption\Util::getAllFiles($dir)
go recursively through a dir and collect all files and sub files.
Source:

lib/private/Encryption/Util.php#165

Parameters:
  • $dir (string) relative to the users files folder
Returns:

array with list of files relative to the users files folder

public OC\Encryption\Util::isFile($path)
check if it is a file uploaded by the user stored in data/user/files
or a metadata file
Source:

lib/private/Encryption/Util.php#192

Parameters:
  • $path (string) relative to the data/ folder
Returns:

bool

public OC\Encryption\Util::getHeaderSize()
return size of encryption header
Source:lib/private/Encryption/Util.php#205
Returns:int
public OC\Encryption\Util::getBlockSize()
return size of block read by a PHP stream
Source:lib/private/Encryption/Util.php#214
Returns:int
public OC\Encryption\Util::getUidAndFilename($path)
get the owner and the path for the file relative to the owners files folder
Source:

lib/private/Encryption/Util.php#225

Parameters:
  • $path (string)
Returns:

array

Throws:

\BadMethodCallException

public OC\Encryption\Util::stripPartialFileExtension($path)
Remove .path extension from a file path
Source:

lib/private/Encryption/Util.php#248

Parameters:
  • $path (string) Path that may identify a .part file
Returns:

string File path without .part extension

public OC\Encryption\Util::getUserWithAccessToMountPoint($users, $groups)
Source:lib/private/Encryption/Util.php#267
public OC\Encryption\Util::isSystemWideMountPoint($path, $uid)
check if the file is stored on a system wide mount point
Source:

lib/private/Encryption/Util.php#300

Parameters:
  • $path (string) relative to /data/user with leading ‘/’
  • $uid (string)
Returns:

bool

public OC\Encryption\Util::isExcluded($path)
check if it is a path which is excluded by ownCloud from encryption
Source:

lib/private/Encryption/Util.php#343

Parameters:
  • $path (string)
Returns:

bool

public OC\Encryption\Util::recoveryEnabled($uid)
check if recovery key is enabled for user
Source:

lib/private/Encryption/Util.php#380

Parameters:
  • $uid (string)
Returns:

bool

public OC\Encryption\Util::setKeyStorageRoot($root)
set new key storage root
Source:

lib/private/Encryption/Util.php#391

Parameters:
  • $root (string) new key store root relative to the data folder
public OC\Encryption\Util::getKeyStorageRoot()
get key storage root
Source:lib/private/Encryption/Util.php#400
Returns:string key storage root