ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5
Auth_OpenID_DiffieHellman Class Reference
+ Collaboration diagram for Auth_OpenID_DiffieHellman:

Public Member Functions

 Auth_OpenID_DiffieHellman ($mod=null, $gen=null, $private=null, $lib=null)
 
 getSharedSecret ($composite)
 
 getPublicKey ()
 
 usingDefaultValues ()
 
 xorSecret ($composite, $secret, $hash_func)
 

Data Fields

 $mod
 
 $gen
 
 $private
 
 $lib = null
 

Detailed Description

Definition at line 43 of file DiffieHellman.php.

Member Function Documentation

◆ Auth_OpenID_DiffieHellman()

Auth_OpenID_DiffieHellman::Auth_OpenID_DiffieHellman (   $mod = null,
  $gen = null,
  $private = null,
  $lib = null 
)

Definition at line 50 of file DiffieHellman.php.

References $gen, $lib, $mod, $private, $r, Auth_OpenID_getDefaultGen(), Auth_OpenID_getDefaultMod(), and Auth_OpenID_getMathLib().

52  {
53  if ($lib === null) {
54  $this->lib = Auth_OpenID_getMathLib();
55  } else {
56  $this->lib = $lib;
57  }
58 
59  if ($mod === null) {
60  $this->mod = $this->lib->init(Auth_OpenID_getDefaultMod());
61  } else {
62  $this->mod = $mod;
63  }
64 
65  if ($gen === null) {
66  $this->gen = $this->lib->init(Auth_OpenID_getDefaultGen());
67  } else {
68  $this->gen = $gen;
69  }
70 
71  if ($private === null) {
72  $r = $this->lib->rand($this->mod);
73  $this->private = $this->lib->add($r, 1);
74  } else {
75  $this->private = $private;
76  }
77 
78  $this->public = $this->lib->powmod($this->gen, $this->private,
79  $this->mod);
80  }
Auth_OpenID_getDefaultMod()
Auth_OpenID_getDefaultGen()
Auth_OpenID_getMathLib()
Definition: BigMath.php:400
$r
Definition: example_031.php:79
+ Here is the call graph for this function:

◆ getPublicKey()

Auth_OpenID_DiffieHellman::getPublicKey ( )

Definition at line 87 of file DiffieHellman.php.

88  {
89  return $this->public;
90  }

◆ getSharedSecret()

Auth_OpenID_DiffieHellman::getSharedSecret (   $composite)

Definition at line 82 of file DiffieHellman.php.

Referenced by xorSecret().

83  {
84  return $this->lib->powmod($composite, $this->private, $this->mod);
85  }
+ Here is the caller graph for this function:

◆ usingDefaultValues()

Auth_OpenID_DiffieHellman::usingDefaultValues ( )

Definition at line 92 of file DiffieHellman.php.

References Auth_OpenID_getDefaultGen(), and Auth_OpenID_getDefaultMod().

93  {
94  return ($this->mod == Auth_OpenID_getDefaultMod() &&
95  $this->gen == Auth_OpenID_getDefaultGen());
96  }
Auth_OpenID_getDefaultMod()
Auth_OpenID_getDefaultGen()
+ Here is the call graph for this function:

◆ xorSecret()

Auth_OpenID_DiffieHellman::xorSecret (   $composite,
  $secret,
  $hash_func 
)

Definition at line 98 of file DiffieHellman.php.

References Auth_OpenID\bytes(), and getSharedSecret().

99  {
100  $dh_shared = $this->getSharedSecret($composite);
101  $dh_shared_str = $this->lib->longToBinary($dh_shared);
102  $hash_dh_shared = $hash_func($dh_shared_str);
103 
104  $xsecret = "";
105  for ($i = 0; $i < Auth_OpenID::bytes($secret); $i++) {
106  $xsecret .= chr(ord($secret[$i]) ^ ord($hash_dh_shared[$i]));
107  }
108 
109  return $xsecret;
110  }
static bytes($str)
Count the number of bytes in a string independently of multibyte support conditions.
Definition: OpenID.php:462
+ Here is the call graph for this function:

Field Documentation

◆ $gen

Auth_OpenID_DiffieHellman::$gen

Definition at line 46 of file DiffieHellman.php.

Referenced by Auth_OpenID_DiffieHellman().

◆ $lib

Auth_OpenID_DiffieHellman::$lib = null

Definition at line 48 of file DiffieHellman.php.

Referenced by Auth_OpenID_DiffieHellman().

◆ $mod

Auth_OpenID_DiffieHellman::$mod

Definition at line 45 of file DiffieHellman.php.

Referenced by Auth_OpenID_DiffieHellman().

◆ $private

Auth_OpenID_DiffieHellman::$private

Definition at line 47 of file DiffieHellman.php.

Referenced by Auth_OpenID_DiffieHellman().


The documentation for this class was generated from the following file: