protected function _parseChallenge($challenge)
    {
        $tokens = array(
            'maxbuf' => 65536,
            'realm' => ''
        );

        preg_match_all('/([a-z-]+)=("[^"]+(?<!\\\)"|[^,]+)/i', $challenge, $matches, PREG_SET_ORDER);

        foreach ($matches as $val) {
            $tokens[$val[1]] = trim($val[2], '"');
        }

        // Required directives.
        if (!isset($tokens['nonce']) || !isset($tokens['algorithm'])) {
            throw new Horde_Imap_Client_Exception(
                Horde_Imap_Client_Translation::r("Authentication failure."),
                Horde_Imap_Client_Exception::SERVER_CONNECT
            );
        }

        return $tokens;
    }
protected function _parseChallenge($challenge)
    {
        $tokens = array(
            'maxbuf' => 65536,
            'realm' => ''
        );

        preg_match_all('/([a-z-]+)=("[^"]+(?<!\\\)"|[^,]+)/i', $challenge, $matches, PREG_SET_ORDER);

        foreach ($matches as $val) {
            $tokens[$val[1]] = trim($val[2], '"');
        }

        // Required directives.
        if (!isset($tokens['nonce']) || !isset($tokens['algorithm'])) {
            throw new Horde_Imap_Client_Exception(
                Horde_Imap_Client_Translation::r("Authentication failure."),
                Horde_Imap_Client_Exception::SERVER_CONNECT
            );
        }

        return $tokens;
    }
protected function _parseChallenge ( $ challenge ) { $ tokens = array ( 'maxbuf' => 65536 , 'realm' => '' ) ; preg_match_all ( '/([a-z-]+)=("[^"]+(?<!\\\)"|[^,]+)/i' , $ challenge , $ matches , PREG_SET_ORDER ) ; foreach ( $ matches as $ val ) { $ tokens [ $ val [ 1 ] ] = trim ( $ val [ 2 ] , '"' ) ; } // Required directives. if ( ! isset ( $ tokens [ 'nonce' ] ) || ! isset ( $ tokens [ 'algorithm' ] ) ) { throw new Horde_Imap_Client_Exception ( Horde_Imap_Client_Translation :: r ( "Authentication failure." ) , Horde_Imap_Client_Exception :: SERVER_CONNECT ) ; } return $ tokens ; }
Parses and verifies the digest challenge.

@param string $challenge  The digest challenge

@return array  The parsed challenge as an array with directives as keys.

@throws Horde_Imap_Client_Exception
Parses and verifies the digest challenge .