Encryption

class OC\Files\Storage\Wrapper\Encryption
Source:lib/private/Files/Storage/Wrapper/Encryption.php#55
Parent:OC\Files\Storage\Wrapper\Wrapper
Used traits:OC\Files\Storage\LocalTempFileTrait

Properties

protected static property OC\Files\Storage\Wrapper\Encryption::$unencryptedSize
Source:lib/private/Files/Storage/Wrapper/Encryption.php#74
Type:array

Methods

public OC\Files\Storage\Wrapper\Encryption::__construct($parameters, $encryptionManager=null, $util=null, $logger=null, $fileHelper=null, $uid=null, $keyStorage=null, $update=null, $mountManager=null, $arrayCache=null)
Source:

lib/private/Files/Storage/Wrapper/Encryption.php#109

Parameters:
public OC\Files\Storage\Wrapper\Encryption::filesize($path)
The result for filesize when called on a folder is required to be 0
Source:

lib/private/Files/Storage/Wrapper/Encryption.php#143

Parameters:
  • $path (string)
Returns:

int

public OC\Files\Storage\Wrapper\Encryption::getMetaData($path)
Source:lib/private/Files/Storage/Wrapper/Encryption.php#195
public OC\Files\Storage\Wrapper\Encryption::getDirectoryContent($directory)
Source:lib/private/Files/Storage/Wrapper/Encryption.php#203
public OC\Files\Storage\Wrapper\Encryption::file_get_contents($path)
Source:

lib/private/Files/Storage/Wrapper/Encryption.php#216

Parameters:
  • $path (string)
Returns:

string

public OC\Files\Storage\Wrapper\Encryption::file_put_contents($path, $data)
Source:

lib/private/Files/Storage/Wrapper/Encryption.php#238

Parameters:
  • $path (string)
  • $data (mixed)
Returns:

int | bool

Source:

lib/private/Files/Storage/Wrapper/Encryption.php#256

Parameters:
  • $path (string)
Returns:

bool

public OC\Files\Storage\Wrapper\Encryption::rename($path1, $path2)
Source:

lib/private/Files/Storage/Wrapper/Encryption.php#277

Parameters:
  • $path1 (string)
  • $path2 (string)
Returns:

bool

public OC\Files\Storage\Wrapper\Encryption::rmdir($path)
Source:

lib/private/Files/Storage/Wrapper/Encryption.php#308

Parameters:
  • $path (string)
Returns:

bool

public OC\Files\Storage\Wrapper\Encryption::isReadable($path)
check if a file can be read
Source:

lib/private/Files/Storage/Wrapper/Encryption.php#327

Parameters:
  • $path (string)
Returns:

bool

public OC\Files\Storage\Wrapper\Encryption::copy($path1, $path2)
Source:

lib/private/Files/Storage/Wrapper/Encryption.php#351

Parameters:
  • $path1 (string)
  • $path2 (string)
Returns:

bool

public OC\Files\Storage\Wrapper\Encryption::fopen($path, $mode)
Source:

lib/private/Files/Storage/Wrapper/Encryption.php#373

Parameters:
  • $path (string)
  • $mode (string)
Returns:

resource | bool

Throws:

\OCP\Encryption\Exceptions\GenericEncryptionException

Throws:

\OC\Encryption\Exceptions\ModuleDoesNotExistsException

Throws:

\OCP\Encryption\Exceptions\GenericEncryptionException

Throws:

\OC\Encryption\Exceptions\ModuleDoesNotExistsException

protected OC\Files\Storage\Wrapper\Encryption::verifyUnencryptedSize($path, $unencryptedSize)
perform some plausibility checks if the the unencrypted size is correct.
If not, we calculate the correct unencrypted size and return it
Source:

lib/private/Files/Storage/Wrapper/Encryption.php#491

Parameters:
  • $path (string) internal path relative to the storage root
  • $unencryptedSize (int) size of the unencrypted file
Returns:

int unencrypted size

protected OC\Files\Storage\Wrapper\Encryption::fixUnencryptedSize($path, $size, $unencryptedSize)
calculate the unencrypted size
Source:

lib/private/Files/Storage/Wrapper/Encryption.php#524

Parameters:
  • $path (string) internal path relative to the storage root
  • $size (int) size of the physical file
  • $unencryptedSize (int) size of the unencrypted file
Returns:

int calculated unencrypted size

public OC\Files\Storage\Wrapper\Encryption::moveFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime=true)
Source:

lib/private/Files/Storage/Wrapper/Encryption.php#608

Parameters:
Returns:

bool

public OC\Files\Storage\Wrapper\Encryption::copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime=false, $isRename=false)
Source:

lib/private/Files/Storage/Wrapper/Encryption.php#643

Parameters:
  • $sourceStorage (OCP\Files\Storage\IStorage)
  • $sourceInternalPath (string)
  • $targetInternalPath (string)
  • $preserveMtime (bool)
  • $isRename (bool)
Returns:

bool

public OC\Files\Storage\Wrapper\Encryption::getLocalFile($path)
get the path to a local version of the file.
The local version of the file can be temporary and doesn’t have to be persistent across requests
Source:

lib/private/Files/Storage/Wrapper/Encryption.php#785

Parameters:
  • $path (string)
Returns:

string

public OC\Files\Storage\Wrapper\Encryption::isLocal()
Returns the wrapped storage’s value for isLocal()
Source:lib/private/Files/Storage/Wrapper/Encryption.php#800
Returns:bool wrapped storage’s isLocal() value
public OC\Files\Storage\Wrapper\Encryption::stat($path)
only the following keys are required in the result: size and mtime
Source:

lib/private/Files/Storage/Wrapper/Encryption.php#814

Parameters:
  • $path (string)
Returns:

array

public OC\Files\Storage\Wrapper\Encryption::hash($type, $path, $raw=false)
Source:

lib/private/Files/Storage/Wrapper/Encryption.php#831

Parameters:
  • $type (string)
  • $path (string)
  • $raw (bool)
Returns:

string

protected OC\Files\Storage\Wrapper\Encryption::getFullPath($path)
return full path, including mount point
Source:

lib/private/Files/Storage/Wrapper/Encryption.php#845

Parameters:
  • $path (string) relative to mount point
Returns:

string full path including mount point

protected OC\Files\Storage\Wrapper\Encryption::readFirstBlock($path)
read first block of encrypted file, typically this will contain the
encryption header
Source:

lib/private/Files/Storage/Wrapper/Encryption.php#856

Parameters:
  • $path (string)
Returns:

string

protected OC\Files\Storage\Wrapper\Encryption::getHeaderSize($path)
return header size of given file
Source:

lib/private/Files/Storage/Wrapper/Encryption.php#872

Parameters:
  • $path (string)
Returns:

int

protected OC\Files\Storage\Wrapper\Encryption::parseRawHeader($rawHeader)
parse raw header to array
Source:

lib/private/Files/Storage/Wrapper/Encryption.php#893

Parameters:
  • $rawHeader (string)
Returns:

array

protected OC\Files\Storage\Wrapper\Encryption::getHeader($path)
read header from file
Source:

lib/private/Files/Storage/Wrapper/Encryption.php#921

Parameters:
  • $path (string)
Returns:

array

protected OC\Files\Storage\Wrapper\Encryption::getEncryptionModule($path)
read encryption module needed to read/write the file located at $path
Source:

lib/private/Files/Storage/Wrapper/Encryption.php#956

Parameters:
  • $path (string)
Returns:

null | \OCP\Encryption\IEncryptionModule

Throws:

\OC\Encryption\Exceptions\ModuleDoesNotExistsException

Throws:

\Exception

Throws:

\OC\Encryption\Exceptions\ModuleDoesNotExistsException

Throws:

\Exception

public OC\Files\Storage\Wrapper\Encryption::updateUnencryptedSize($path, $unencryptedSize)
Source:

lib/private/Files/Storage/Wrapper/Encryption.php#976

Parameters:
  • $path (string)
  • $unencryptedSize (int)
protected OC\Files\Storage\Wrapper\Encryption::copyKeys($source, $target)
copy keys to new location
Source:

lib/private/Files/Storage/Wrapper/Encryption.php#987

Parameters:
  • $source (string) path relative to data/
  • $target (string) path relative to data/
Returns:

bool

protected OC\Files\Storage\Wrapper\Encryption::isVersion($path)
check if path points to a files version
Source:

lib/private/Files/Storage/Wrapper/Encryption.php#1001

Parameters:
  • $path
Returns:

bool

protected OC\Files\Storage\Wrapper\Encryption::shouldEncrypt($path)
check if the given storage should be encrypted or not
Source:

lib/private/Files/Storage/Wrapper/Encryption.php#1012

Parameters:
  • $path
Returns:

bool

public OC\Files\Storage\Wrapper\Encryption::writeStream($path, $stream, $size=null)
Source:lib/private/Files/Storage/Wrapper/Encryption.php#1032