Public Member Functions | Data Fields | Static Public Attributes | Protected Member Functions

Zend_Crypt_DiffieHellman Class Reference

Public Member Functions

 __construct ($prime, $generator, $privateKey=null, $privateKeyType=self::NUMBER)
 generateKeys ()
 setPublicKey ($number, $type=self::NUMBER)
 getPublicKey ($type=self::NUMBER)
 computeSecretKey ($publicKey, $type=self::NUMBER, $output=self::NUMBER)
 getSharedSecretKey ($type=self::NUMBER)
 setPrime ($number)
 getPrime ()
 setGenerator ($number)
 getGenerator ()
 setPrivateKey ($number, $type=self::NUMBER)
 getPrivateKey ($type=self::NUMBER)
 hasPrivateKey ()
 setBigIntegerMath ($extension=null)

Data Fields

const BINARY = 'binary'
const NUMBER = 'number'
const BTWOC = 'btwoc'

Static Public Attributes

static $useOpenssl = true

Protected Member Functions

 _generatePrivateKey ()

Detailed Description

Definition at line 33 of file DiffieHellman.php.


Constructor & Destructor Documentation

__construct ( prime,
generator,
privateKey = null,
privateKeyType = self::NUMBER 
)

Constructor; if set construct the object using the parameter array to set values for Prime, Generator and Private. If a Private Key is not set, one will be generated at random.

Parameters:
string$prime
string$generator
string$privateKey
string$privateKeyType
Returns:
void

Definition at line 107 of file DiffieHellman.php.


Member Function Documentation

_generatePrivateKey (  ) [protected]

In the event a private number/key has not been set by the user, or generated by ext/openssl, a best attempt will be made to generate a random key. Having a random number generator installed on linux/bsd is highly recommended! The alternative is not recommended for production unless without any other option.

Returns:
string

Definition at line 374 of file DiffieHellman.php.

computeSecretKey ( publicKey,
type = self::NUMBER,
output = self::NUMBER 
)

Compute the shared secret key based on the public key received from the the second party to this transaction. This should agree to the secret key the second party computes on our own public key. Once in agreement, the key is known to only to both parties. By default, the function expects the public key to be in binary form which is the typical format when being transmitted.

If you need the binary form of the shared secret key, call getSharedSecretKey() with the optional parameter for Binary output.

Parameters:
string$publicKey
string$type
Returns:
mixed

Definition at line 200 of file DiffieHellman.php.

generateKeys (  )

Generate own public key. If a private number has not already been set, one will be generated at this stage.

Returns:
Zend_Crypt_DiffieHellman

Definition at line 123 of file DiffieHellman.php.

getGenerator (  )

Getter for the value of the generator number

Returns:
string

Definition at line 289 of file DiffieHellman.php.

getPrime (  )

Getter for the value of the prime number

Returns:
string

Definition at line 258 of file DiffieHellman.php.

getPrivateKey ( type = self::NUMBER )

Getter for the value of the private number

Parameters:
string$type
Returns:
string

Definition at line 324 of file DiffieHellman.php.

getPublicKey ( type = self::NUMBER )

Returns own public key for communication to the second party to this transaction.

Parameters:
string$type
Returns:
string

Definition at line 171 of file DiffieHellman.php.

getSharedSecretKey ( type = self::NUMBER )

Return the computed shared secret key from the DiffieHellman transaction

Parameters:
string$type
Returns:
string

Definition at line 223 of file DiffieHellman.php.

hasPrivateKey (  )

Check whether a private key currently exists.

Returns:
boolean

Definition at line 342 of file DiffieHellman.php.

setBigIntegerMath ( extension = null )

Setter to pass an extension parameter which is used to create a specific BigInteger instance for a specific extension type. Allows manual setting of the class in case of an extension problem or bug.

Parameters:
string$extension
Returns:
void

See also:
Zend_Crypt_Math

Definition at line 356 of file DiffieHellman.php.

setGenerator ( number )

Setter for the value of the generator number

Parameters:
string$number
Returns:
Zend_Crypt_DiffieHellman

Definition at line 274 of file DiffieHellman.php.

setPrime ( number )

Setter for the value of the prime number

Parameters:
string$number
Returns:
Zend_Crypt_DiffieHellman

Definition at line 243 of file DiffieHellman.php.

setPrivateKey ( number,
type = self::NUMBER 
)

Setter for the value of the private number

Parameters:
string$number
string$type
Returns:
Zend_Crypt_DiffieHellman

Definition at line 305 of file DiffieHellman.php.

setPublicKey ( number,
type = self::NUMBER 
)

Setter for the value of the public number

Parameters:
string$number
string$type
Returns:
Zend_Crypt_DiffieHellman

Definition at line 151 of file DiffieHellman.php.


Field Documentation

const BINARY = 'binary'

Constants

Definition at line 92 of file DiffieHellman.php.


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