getEncryption()->AESDecryptCBC($data, $serverKey, 256); } /** * Encodes the data. The data is JSON encoded by this method before encapsulation takes place. Encrypted * encapsulations will then encrypt the data and base64-encode it before returning it. * * The data being encoded correspond to the body > data structure described in the API documentation * * @param string $serverKey The server key we need to encode data * @param mixed $data The data to encode, typically a string, array or object * * @return string The encapsulated data * * @see https://www.akeebabackup.com/documentation/json-api/ar01s02s02.html * * @throws \RuntimeException When the server capabilities don't match the requested encapsulation * @throws \InvalidArgumentException When $data cannot be converted to JSON */ public function encode($serverKey, $data) { return base64_encode($this->getEncryption()->AESEncryptCBC($data, $serverKey, 256)); } }