function signMessage($message)
    {
        if ($message->hasKey(Auth_OpenID_OPENID_NS, 'sig') ||
            $message->hasKey(Auth_OpenID_OPENID_NS, 'signed')) {
            // Already has a sig
            return null;
        }

        $extant_handle = $message->getArg(Auth_OpenID_OPENID_NS,
                                          'assoc_handle');

        if ($extant_handle && ($extant_handle != $this->handle)) {
            // raise ValueError("Message has a different association handle")
            return null;
        }

        $signed_message = $message;
        $signed_message->setArg(Auth_OpenID_OPENID_NS, 'assoc_handle',
                                $this->handle);

        $message_keys = array_keys($signed_message->toPostArgs());
        $signed_list = array();
        $signed_prefix = 'openid.';

        foreach ($message_keys as $k) {
            if (strpos($k, $signed_prefix) === 0) {
                $signed_list[] = substr($k, strlen($signed_prefix));
            }
        }

        $signed_list[] = 'signed';
        sort($signed_list);

        $signed_message->setArg(Auth_OpenID_OPENID_NS, 'signed',
                                implode(',', $signed_list));
        $sig = $this->getMessageSignature($signed_message);
        $signed_message->setArg(Auth_OpenID_OPENID_NS, 'sig', $sig);
        return $signed_message;
    }
function signMessage($message)
    {
        if ($message->hasKey(Auth_OpenID_OPENID_NS, 'sig') ||
            $message->hasKey(Auth_OpenID_OPENID_NS, 'signed')) {
            // Already has a sig
            return null;
        }

        $extant_handle = $message->getArg(Auth_OpenID_OPENID_NS,
                                          'assoc_handle');

        if ($extant_handle && ($extant_handle != $this->handle)) {
            // raise ValueError("Message has a different association handle")
            return null;
        }

        $signed_message = $message;
        $signed_message->setArg(Auth_OpenID_OPENID_NS, 'assoc_handle',
                                $this->handle);

        $message_keys = array_keys($signed_message->toPostArgs());
        $signed_list = array();
        $signed_prefix = 'openid.';

        foreach ($message_keys as $k) {
            if (strpos($k, $signed_prefix) === 0) {
                $signed_list[] = substr($k, strlen($signed_prefix));
            }
        }

        $signed_list[] = 'signed';
        sort($signed_list);

        $signed_message->setArg(Auth_OpenID_OPENID_NS, 'signed',
                                implode(',', $signed_list));
        $sig = $this->getMessageSignature($signed_message);
        $signed_message->setArg(Auth_OpenID_OPENID_NS, 'sig', $sig);
        return $signed_message;
    }
function signMessage ( $ message ) { if ( $ message -> hasKey ( Auth_OpenID_OPENID_NS , 'sig' ) || $ message -> hasKey ( Auth_OpenID_OPENID_NS , 'signed' ) ) { // Already has a sig return null ; } $ extant_handle = $ message -> getArg ( Auth_OpenID_OPENID_NS , 'assoc_handle' ) ; if ( $ extant_handle && ( $ extant_handle != $ this -> handle ) ) { // raise ValueError("Message has a different association handle") return null ; } $ signed_message = $ message ; $ signed_message -> setArg ( Auth_OpenID_OPENID_NS , 'assoc_handle' , $ this -> handle ) ; $ message_keys = array_keys ( $ signed_message -> toPostArgs ( ) ) ; $ signed_list = array ( ) ; $ signed_prefix = 'openid.' ; foreach ( $ message_keys as $ k ) { if ( strpos ( $ k , $ signed_prefix ) === 0 ) { $ signed_list [ ] = substr ( $ k , strlen ( $ signed_prefix ) ) ; } } $ signed_list [ ] = 'signed' ; sort ( $ signed_list ) ; $ signed_message -> setArg ( Auth_OpenID_OPENID_NS , 'signed' , implode ( ',' , $ signed_list ) ) ; $ sig = $ this -> getMessageSignature ( $ signed_message ) ; $ signed_message -> setArg ( Auth_OpenID_OPENID_NS , 'sig' , $ sig ) ; return $ signed_message ; }
Generate a signature for some fields in a dictionary

@access private
@param Auth_OpenID_Message $message
@return string $signature The signature, base64 encoded
@internal param array $fields The fields to sign, in order; this is an
array of strings.
@internal param array $data Dictionary of values to sign (an array of
string => string pairs).
Generate a signature for some fields in a dictionary