IEncryptionModule

interface OCP\Encryption\IEncryptionModule
Interface IEncryptionModule
Source:lib/public/Encryption/IEncryptionModule.php#38

Methods

public OCP\Encryption\IEncryptionModule::getId()
Source:lib/public/Encryption/IEncryptionModule.php#44
Returns:string defining the technical unique id
Since:8.1.0
public OCP\Encryption\IEncryptionModule::getDisplayName()
In comparison to getKey() this function returns a human readable (maybe translated) name
Source:lib/public/Encryption/IEncryptionModule.php#52
Returns:string
Since:8.1.0
public OCP\Encryption\IEncryptionModule::begin($path, $user, $mode, $header, $accessList)
start receiving chunks from a file. This is the place where you can
perform some initial step before starting encrypting/decrypting the
chunks
Source:

lib/public/Encryption/IEncryptionModule.php#70

Parameters:
  • $path (string) to the file
  • $user (string) who read/write the file (null for public access)
  • $mode (string) php stream open mode
  • $header (array) contains the header data read from the file
  • $accessList (array) who has access to the file contains the key ‘users’ and ‘public’
$return array $header contain data as key-value pairs which should be

written to the header, in case of a write operation or if no additional data is needed return a empty array

Since:

8.1.0

public OCP\Encryption\IEncryptionModule::end($path, $position)
last chunk received. This is the place where you can perform some final
operation and return some remaining data if something is left in your
buffer.
Source:

lib/public/Encryption/IEncryptionModule.php#86

Parameters:
  • $path (string) to the file
  • $position (string) id of the last block (looks like “<Number>end”)
Returns:

string remained data which should be written to the file in case of a write operation

Since:

8.1.0

Since:

8.1.0

public OCP\Encryption\IEncryptionModule::encrypt($data, $position)
encrypt data
Source:

lib/public/Encryption/IEncryptionModule.php#99

Parameters:
  • $data (string) you want to encrypt
  • $position (string) position of the block we want to encrypt (starts with ‘0’)
Returns:

mixed encrypted data

Since:

8.1.0

Since:

8.1.0

public OCP\Encryption\IEncryptionModule::decrypt($data, $position)
decrypt data
Source:

lib/public/Encryption/IEncryptionModule.php#112

Parameters:
  • $data (string) you want to decrypt
  • $position (int | string) position of the block we want to decrypt
Returns:

mixed decrypted data

Since:

8.1.0

Since:

8.1.0

public OCP\Encryption\IEncryptionModule::update($path, $uid, $accessList)
update encrypted file, e.g. give additional users access to the file
Source:

lib/public/Encryption/IEncryptionModule.php#123

Parameters:
  • $path (string) path to the file which should be updated
  • $uid (string) of the user who performs the operation
  • $accessList (array) who has access to the file contains the key ‘users’ and ‘public’
Returns:

bool

Since:

8.1.0

public OCP\Encryption\IEncryptionModule::shouldEncrypt($path)
should the file be encrypted or not
Source:

lib/public/Encryption/IEncryptionModule.php#132

Parameters:
  • $path (string)
Returns:

bool

Since:

8.1.0

public OCP\Encryption\IEncryptionModule::getUnencryptedBlockSize($signed=false)
get size of the unencrypted payload per block.
ownCloud read/write files with a block size of 8192 byte
Source:

lib/public/Encryption/IEncryptionModule.php#142

Parameters:
  • $signed (bool)
Returns:

int

Since:

8.1.0 optional parameter $signed was added in 9.0.0

public OCP\Encryption\IEncryptionModule::isReadable($path, $uid)
check if the encryption module is able to read the file,
e.g. if all encryption keys exists
Source:

lib/public/Encryption/IEncryptionModule.php#153

Parameters:
  • $path (string)
  • $uid (string) user for whom we want to check if he can read the file
Returns:

bool

Since:

8.1.0

public OCP\Encryption\IEncryptionModule::encryptAll($input, $output)
Initial encryption of all files
Source:

lib/public/Encryption/IEncryptionModule.php#162

Parameters:
  • $input (Symfony\Component\Console\Input\InputInterface)
  • $output (Symfony\Component\Console\Output\OutputInterface) write some status information to the terminal during encryption
Since:

8.2.0

public OCP\Encryption\IEncryptionModule::prepareDecryptAll($input, $output, $user="")
prepare encryption module to decrypt all files
Source:

lib/public/Encryption/IEncryptionModule.php#173

Parameters:
  • $input (Symfony\Component\Console\Input\InputInterface)
  • $output (Symfony\Component\Console\Output\OutputInterface) write some status information to the terminal during encryption
  • $user (optional) for which the files should be decrypted, default = all users
Returns:

bool return false on failure or if it isn’t supported by the module

Since:

8.2.0

public OCP\Encryption\IEncryptionModule::isReadyForUser($user)
Check if the module is ready to be used by that specific user.
In case a module is not ready - because e.g. key pairs have not been generated
upon login this method can return false before any operation starts and might
cause issues during operations.
Source:

lib/public/Encryption/IEncryptionModule.php#185

Parameters:
  • $user (string)
Returns:

bool

Since:

9.1.0

public OCP\Encryption\IEncryptionModule::needDetailedAccessList()
Does the encryption module needs a detailed list of users with access to the file?
For example if the encryption module uses per-user encryption keys and needs to know
the users with access to the file to encrypt/decrypt it.
Source:lib/public/Encryption/IEncryptionModule.php#195
Since:13.0.0
Returns:bool