ICrypto
Class Crypto provides a high-level encryption layer using AES-CBC. If no key has been provided it will use the secret defined in config.php as key. Additionally the message will be HMAC'd.
Usage: $encryptWithDefaultPassword = \OC::$server->getCrypto()->encrypt('EncryptedText'); $encryptWithCustomPassword = \OC::$server->getCrypto()->encrypt('EncryptedText', 'password');
Tags
Table of Contents
- calculateHMAC() : string
 - decrypt() : string
 - Decrypts a value and verifies the HMAC (Encrypt-Then-Mac)
 - encrypt() : string
 - Encrypts a value and adds an HMAC (Encrypt-Then-MAC)
 
Methods
calculateHMAC()
    public
                calculateHMAC(string $message[, string $password = '' ]) : string
    
        Parameters
- $message : string
 - 
                    
The message to authenticate
 - $password : string = ''
 - 
                    
Password to use (defaults to
secretin config.php) 
Tags
Return values
string —Calculated HMAC
decrypt()
Decrypts a value and verifies the HMAC (Encrypt-Then-Mac)
    public
                decrypt(string $authenticatedCiphertext[, string $password = '' ]) : string
    
        Parameters
- $authenticatedCiphertext : string
 - $password : string = ''
 - 
                    
Password to encrypt, if not specified the secret from config.php will be taken
 
Tags
Return values
string —plaintext
encrypt()
Encrypts a value and adds an HMAC (Encrypt-Then-MAC)
    public
                encrypt(string $plaintext[, string $password = '' ]) : string
    
        Parameters
- $plaintext : string
 - $password : string = ''
 - 
                    
Password to encrypt, if not specified the secret from config.php will be taken
 
Tags
Return values
string —Authenticated ciphertext