\OCP\EncryptionIEncryptionModule

Interface IEncryptionModule

Summary

Methods
Constants
getId()
getDisplayName()
begin()
end()
encrypt()
decrypt()
update()
shouldEncrypt()
getUnencryptedBlockSize()
isReadable()
encryptAll()
prepareDecryptAll()
isReadyForUser()
No constants found
No protected methods found
N/A
No private methods found
N/A

Methods

getId()

getId() : string

Returns

string —

defining the technical unique id

getDisplayName()

getDisplayName() : string

In comparison to getKey() this function returns a human readable (maybe translated) name

Returns

string

begin()

begin(string  $path, string  $user, string  $mode, array  $header, array  $accessList) 

start receiving chunks from a file. This is the place where you can perform some initial step before starting encrypting/decrypting the chunks

Parameters

string $path

to the file

string $user

who read/write the file (null for public access)

string $mode

php stream open mode

array $header

contains the header data read from the file

array $accessList

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

end()

end(string  $path, string  $position) : string

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.

Parameters

string $path

to the file

string $position

id of the last block (looks like "end")

Returns

string —

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

encrypt()

encrypt(string  $data, string  $position) : mixed

encrypt data

Parameters

string $data

you want to encrypt

string $position

position of the block we want to encrypt (starts with '0')

Returns

mixed —

encrypted data

decrypt()

decrypt(string  $data, string  $position) : mixed

decrypt data

Parameters

string $data

you want to decrypt

string $position

position of the block we want to decrypt

Returns

mixed —

decrypted data

update()

update(string  $path, string  $uid, array  $accessList) : boolean

update encrypted file, e.g. give additional users access to the file

Parameters

string $path

path to the file which should be updated

string $uid

of the user who performs the operation

array $accessList

who has access to the file contains the key 'users' and 'public'

Returns

boolean

shouldEncrypt()

shouldEncrypt(string  $path) : boolean

should the file be encrypted or not

Parameters

string $path

Returns

boolean

getUnencryptedBlockSize()

getUnencryptedBlockSize(boolean  $signed = false) : integer

get size of the unencrypted payload per block.

ownCloud read/write files with a block size of 8192 byte

Parameters

boolean $signed

Returns

integer

isReadable()

isReadable(string  $path, string  $uid) : boolean

check if the encryption module is able to read the file, e.g. if all encryption keys exists

Parameters

string $path
string $uid

user for whom we want to check if he can read the file

Returns

boolean

encryptAll()

encryptAll(\Symfony\Component\Console\Input\InputInterface  $input, \Symfony\Component\Console\Output\OutputInterface  $output) 

Initial encryption of all files

Parameters

\Symfony\Component\Console\Input\InputInterface $input
\Symfony\Component\Console\Output\OutputInterface $output

write some status information to the terminal during encryption

prepareDecryptAll()

prepareDecryptAll(\Symfony\Component\Console\Input\InputInterface  $input, \Symfony\Component\Console\Output\OutputInterface  $output,   $user = '') : boolean

prepare encryption module to decrypt all files

Parameters

\Symfony\Component\Console\Input\InputInterface $input
\Symfony\Component\Console\Output\OutputInterface $output

write some status information to the terminal during encryption

$user

(optional) for which the files should be decrypted, default = all users

Returns

boolean —

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

isReadyForUser()

isReadyForUser(string  $user) : boolean

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.

Parameters

string $user

Returns

boolean