public static function encodeSecureCookie($value, $expires, $secret, $algorithm, $mode)
    {
        $key = hash_hmac('sha1', $expires, $secret);
        $iv = self::get_iv($expires, $secret);
        $secureString = base64_encode(self::encrypt($value, $key, $iv, array(
            'algorithm' => $algorithm,
            'mode' => $mode
        )));
        $verificationString = hash_hmac('sha1', $expires . $value, $key);

        return implode('|', array($expires, $secureString, $verificationString));
    }