function SendEncryptedResponse($message) { $aes = new AES(AES_MODE_CBC); $aes->setKeyLength(256); $aes->setKey(Base64UrlDecode($_SESSION['key'])); $aes->setIV(Base64UrlDecode($_SESSION['iv'])); $aes->enablePadding(); // This is PKCS echo Base64UrlEncode($aes->encrypt($message)); exit; }
/** * Encrypts the message to be sent using AES. * Make sure you have not output any other text before or after calling this. * * @param String $message The message to be transported online */ function SendEncryptedResponse($message) { $aes = new AES(AES_MODE_CBC); $aes->setKeyLength(256); $aes->setKey($this->Base64UrlDecode($this->key)); $aes->setIV($this->Base64UrlDecode($this->iv)); $aes->enablePadding(); // This is PKCS echo $this->Base64UrlEncode($aes->encrypt($message)); exit; }