protected function dh()
    {
        if(empty($this->data['openid_dh_modulus'])) {
            $this->data['openid_dh_modulus'] = $this->default_modulus;
        }
        
        if(empty($this->data['openid_dh_gen'])) {
            $this->data['openid_dh_gen'] = $this->default_gen;
        }
        
        if(empty($this->data['openid_dh_consumer_public'])) {
            $this->directErrorResponse();
        }
        
        $modulus = $this->b64dec($this->data['openid_dh_modulus']);
        $gen = $this->b64dec($this->data['openid_dh_gen']);
        $consumerKey = $this->b64dec($this->data['openid_dh_consumer_public']);
        
        $privateKey = $this->keygen(strlen($modulus));
        $publicKey = $this->powmod($gen, $privateKey, $modulus);
        $ss = $this->powmod($consumerKey, $privateKey, $modulus);
        
        $mac = $this->x_or(hash($this->assoc['hash'], $ss, true), $this->shared_secret($this->assoc['hash']));
        $this->assoc['dh_server_public'] = $this->decb64($publicKey);
        $this->assoc['mac'] = base64_encode($mac);
    }
protected function dh()
    {
        if(empty($this->data['openid_dh_modulus'])) {
            $this->data['openid_dh_modulus'] = $this->default_modulus;
        }
        
        if(empty($this->data['openid_dh_gen'])) {
            $this->data['openid_dh_gen'] = $this->default_gen;
        }
        
        if(empty($this->data['openid_dh_consumer_public'])) {
            $this->directErrorResponse();
        }
        
        $modulus = $this->b64dec($this->data['openid_dh_modulus']);
        $gen = $this->b64dec($this->data['openid_dh_gen']);
        $consumerKey = $this->b64dec($this->data['openid_dh_consumer_public']);
        
        $privateKey = $this->keygen(strlen($modulus));
        $publicKey = $this->powmod($gen, $privateKey, $modulus);
        $ss = $this->powmod($consumerKey, $privateKey, $modulus);
        
        $mac = $this->x_or(hash($this->assoc['hash'], $ss, true), $this->shared_secret($this->assoc['hash']));
        $this->assoc['dh_server_public'] = $this->decb64($publicKey);
        $this->assoc['mac'] = base64_encode($mac);
    }
protected function dh ( ) { if ( empty ( $ this -> data [ 'openid_dh_modulus' ] ) ) { $ this -> data [ 'openid_dh_modulus' ] = $ this -> default_modulus ; } if ( empty ( $ this -> data [ 'openid_dh_gen' ] ) ) { $ this -> data [ 'openid_dh_gen' ] = $ this -> default_gen ; } if ( empty ( $ this -> data [ 'openid_dh_consumer_public' ] ) ) { $ this -> directErrorResponse ( ) ; } $ modulus = $ this -> b64dec ( $ this -> data [ 'openid_dh_modulus' ] ) ; $ gen = $ this -> b64dec ( $ this -> data [ 'openid_dh_gen' ] ) ; $ consumerKey = $ this -> b64dec ( $ this -> data [ 'openid_dh_consumer_public' ] ) ; $ privateKey = $ this -> keygen ( strlen ( $ modulus ) ) ; $ publicKey = $ this -> powmod ( $ gen , $ privateKey , $ modulus ) ; $ ss = $ this -> powmod ( $ consumerKey , $ privateKey , $ modulus ) ; $ mac = $ this -> x_or ( hash ( $ this -> assoc [ 'hash' ] , $ ss , true ) , $ this -> shared_secret ( $ this -> assoc [ 'hash' ] ) ) ; $ this -> assoc [ 'dh_server_public' ] = $ this -> decb64 ( $ publicKey ) ; $ this -> assoc [ 'mac' ] = base64_encode ( $ mac ) ; }
Encrypts the MAC key using DH key exchange.
Encrypts the MAC key using DH key exchange .