IEncryptionModule
Interface IEncryptionModule
Tags
Table of Contents
- begin() : mixed
- start receiving chunks from a file. This is the place where you can perform some initial step before starting encrypting/decrypting the chunks
- decrypt() : mixed
- decrypt data
- encrypt() : mixed
- encrypt data
- encryptAll() : mixed
- Initial encryption of all files
- end() : 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.
- getDisplayName() : string
- In comparison to getKey() this function returns a human readable (maybe translated) name
- getId() : string
- getUnencryptedBlockSize() : int
- get size of the unencrypted payload per block.
- isReadable() : bool
- check if the encryption module is able to read the file, e.g. if all encryption keys exists
- isReadyForUser() : bool
- Check if the module is ready to be used by that specific user.
- needDetailedAccessList() : bool
- 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.
- prepareDecryptAll() : bool
- prepare encryption module to decrypt all files
- shouldEncrypt() : bool
- should the file be encrypted or not
- update() : bool
- update encrypted file, e.g. give additional users access to the file
Methods
begin()
start receiving chunks from a file. This is the place where you can perform some initial step before starting encrypting/decrypting the chunks
    public
                begin(string $path, string $user, string $mode, array $header, array $accessList) : mixed
    
        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 
Tags
Return values
mixed —decrypt()
decrypt data
    public
                decrypt(string $data, string $position) : mixed
    
        Parameters
- $data : string
- 
                    you want to decrypt 
- $position : string
- 
                    position of the block we want to decrypt 
Tags
Return values
mixed —decrypted data
encrypt()
encrypt data
    public
                encrypt(string $data, string $position) : mixed
    
        Parameters
- $data : string
- 
                    you want to encrypt 
- $position : string
- 
                    position of the block we want to encrypt (starts with '0') 
Tags
Return values
mixed —encrypted data
encryptAll()
Initial encryption of all files
    public
                encryptAll(InputInterface $input, OutputInterface $output) : mixed
    
        Parameters
- $input : InputInterface
- $output : OutputInterface
- 
                    write some status information to the terminal during encryption 
Tags
Return values
mixed —end()
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.
    public
                end(string $path, string $position) : string
    
        Parameters
- $path : string
- 
                    to the file 
- $position : string
- 
                    id of the last block (looks like "<Number>end") 
Tags
Return values
string —remained data which should be written to the file in case of a write operation
getDisplayName()
In comparison to getKey() this function returns a human readable (maybe translated) name
    public
                getDisplayName() : string
    
    
    
    Tags
Return values
string —getId()
    public
                getId() : string
    
    
    
    Tags
Return values
string —defining the technical unique id
getUnencryptedBlockSize()
get size of the unencrypted payload per block.
    public
                getUnencryptedBlockSize([bool $signed = false ]) : int
        ownCloud read/write files with a block size of 8192 byte
Parameters
- $signed : bool = false
Tags
Return values
int —isReadable()
check if the encryption module is able to read the file, e.g. if all encryption keys exists
    public
                isReadable(string $path, string $uid) : bool
    
        Parameters
- $path : string
- $uid : string
- 
                    user for whom we want to check if he can read the file 
Tags
Return values
bool —isReadyForUser()
Check if the module is ready to be used by that specific user.
    public
                isReadyForUser(string $user) : bool
        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
- $user : string
Tags
Return values
bool —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.
    public
                needDetailedAccessList() : bool
    
    
    
    Tags
Return values
bool —prepareDecryptAll()
prepare encryption module to decrypt all files
    public
                prepareDecryptAll(InputInterface $input, OutputInterface $output[,  $user = '' ]) : bool
    
        Parameters
- $input : InputInterface
- $output : OutputInterface
- 
                    write some status information to the terminal during encryption 
- $user : = ''
- 
                    for which the files should be decrypted, default = all users 
Tags
Return values
bool —return false on failure or if it isn't supported by the module
shouldEncrypt()
should the file be encrypted or not
    public
                shouldEncrypt(string $path) : bool
    
        Parameters
- $path : string
Tags
Return values
bool —update()
update encrypted file, e.g. give additional users access to the file
    public
                update(string $path, string $uid, array $accessList) : bool
    
        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'