Пример #1
0
 /**
  * Initialize the diffie-hellman parameters for the association request.
  * 
  * @return void
  */
 public function init()
 {
     if ($this->cdh === null) {
         $this->cdh = new Crypt_DiffieHellman(self::DH_DEFAULT_MODULUS, self::DH_DEFAULT_GENERATOR);
         $this->cdh->generateKeys();
     }
     // Set public key
     $this->message->set('openid.dh_consumer_public', base64_encode($this->cdh->getPublicKey(Crypt_DiffieHellman::BTWOC)));
     // Set modulus
     $prime = $this->cdh->getPrime(Crypt_DiffieHellman::BTWOC);
     $this->message->set('openid.dh_modulus', base64_encode($prime));
     // Set prime
     $gen = $this->cdh->getGenerator(Crypt_DiffieHellman::BTWOC);
     $this->message->set('openid.dh_gen', base64_encode($gen));
 }