lib/private/Security/Crypto.php
/**
	 * Encrypts a value and adds an HMAC (Encrypt-Then-MAC)
	 * @param string $plaintext
	 * @param string $password Password to encrypt, if not specified the secret from config.php will be taken
	 * @return string Authenticated ciphertext
	 */
Encrypts a value and adds an HMAC (Encrypt-Then-MAC)
@param string $plaintext
@param string $password Password to encrypt, if not specified the secret from config.php will be taken
@return string Authenticated ciphertext
Encrypts a value and adds an HMAC ( Encrypt - Then - MAC ) @param string $plaintext @param string $password Password to encrypt if not specified the secret from config . php will be taken @return string Authenticated ciphertext
public function encrypt($plaintext, $password = '') {
		if($password === '') {
			$password = $this->config->getSystemValue('secret');
		}
		$this->cipher->setPassword($password);
		$iv = $this->random->generate($this->ivLength);
		$this->cipher->setIV($iv);
		$ciphertext = bin2hex($this->cipher->encrypt($plaintext));
		$hmac = bin2hex($this->calculateHMAC($ciphertext.$iv, $password));
		return $ciphertext.'|'.$iv.'|'.$hmac;
	}
public function encrypt ( $ plaintext , $ password = '' ) { if ( $ password === '' ) { $ password = $ this -> config -> getSystemValue ( 'secret' ) ; } $ this -> cipher -> setPassword ( $ password ) ; $ iv = $ this -> random -> generate ( $ this -> ivLength ) ; $ this -> cipher -> setIV ( $ iv ) ; $ ciphertext = bin2hex ( $ this -> cipher -> encrypt ( $ plaintext ) ) ; $ hmac = bin2hex ( $ this -> calculateHMAC ( $ ciphertext . $ iv , $ password ) ) ; return $ ciphertext . '|' . $ iv . '|' . $ hmac ; }
Encrypts a value and adds an HMAC (Encrypt-Then-MAC)
 @param string $plaintext
 @param string $password Password to encrypt, if not specified the secret from config.php will be taken
 @return string Authenticated ciphertext
Encrypts a value and adds an HMAC ( Encrypt - Then - MAC ) @param string $plaintext @param string $password Password to encrypt if not specified the secret from config . php will be taken @return string Authenticated ciphertext