/** * Encodes the given messages to a transferable string. * @param \System\Collection\Vector A Vector with \System\System\Interaction\Message or \System\System\Interaction\Response objects. * @param string The custom encryptionkey. This is used over the systems default key * @return string The encoded string */ public static final function encode(\System\Collection\Vector $messages, $customEncryptionKey = '') { $messagesToSend = array(); foreach ($messages as $message) { $messagesToSend[] = serialize($message); } $messageToSend = json_encode($messagesToSend); $encodedMessage = \System\Security\AESEncoding::encode($messageToSend, $customEncryptionKey ?: self::getEncryptionKey(), \System\Security\AESEncoding::CYPHER_256); return $encodedMessage; }
/** * Encodes the given value to AES using the techniques and keys from the DynamicBaseObj * @param string The value to encode * @return string The encoded value */ public static final function encodeAES($value) { return \System\Security\AESEncoding::encode($value, self::ENCRYPTION_KEY, \System\Security\AESEncoding::CYPHER_128); }