getPublicKey() public method

public getPublicKey ( )
 function runTest()
 {
     $lib =& Auth_OpenID_getMathLib();
     $shared = $lib->init($this->shared);
     $dh1 = new Auth_OpenID_DiffieHellman(null, null, $this->p1);
     $dh2 = new Auth_OpenID_DiffieHellman(null, null, $this->p2);
     $sh1 = $dh1->getSharedSecret($dh2->getPublicKey());
     $sh2 = $dh2->getSharedSecret($dh1->getPublicKey());
     $this->assertEquals($lib->cmp($shared, $sh1), 0);
     $this->assertEquals($lib->cmp($shared, $sh2), 0);
 }
Esempio n. 2
0
 /**
  * Perform the server side of the OpenID Diffie-Hellman association
  */
 function serverAssociate($consumer_args, $assoc_secret)
 {
     $lib =& Auth_OpenID_getMathLib();
     if (isset($consumer_args['openid.dh_modulus'])) {
         $mod = $lib->base64ToLong($consumer_args['openid.dh_modulus']);
     } else {
         $mod = null;
     }
     if (isset($consumer_args['openid.dh_gen'])) {
         $gen = $lib->base64ToLong($consumer_args['openid.dh_gen']);
     } else {
         $gen = null;
     }
     $cpub64 = @$consumer_args['openid.dh_consumer_public'];
     if (!isset($cpub64)) {
         return false;
     }
     $dh = new Auth_OpenID_DiffieHellman($mod, $gen);
     $cpub = $lib->base64ToLong($cpub64);
     $mac_key = $dh->xorSecret($cpub, $assoc_secret);
     $enc_mac_key = base64_encode($mac_key);
     $spub64 = $lib->longToBase64($dh->getPublicKey());
     $server_args = array('session_type' => 'DH-SHA1', 'dh_server_public' => $spub64, 'enc_mac_key' => $enc_mac_key);
     return $server_args;
 }