.. Crypt/PublicKey/DiffieHellman.php generated using docpx on 01/30/13 03:26pm Class ***** Zend\\Crypt\\PublicKey\\DiffieHellman ===================================== PHP implementation of the Diffie-Hellman public key encryption algorithm. Allows two unassociated parties to establish a joint shared secret key to be used in encrypting subsequent communications. Methods ------- __construct +++++++++++ .. function:: __construct() 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. :param string: :param string: :param string: :param string: useOpensslExtension +++++++++++++++++++ .. function:: useOpensslExtension() Set whether to use openssl extension :param bool: generateKeys ++++++++++++ .. function:: generateKeys() Generate own public key. If a private number has not already been set, one will be generated at this stage. :rtype: DiffieHellman :throws: \Zend\Crypt\Exception\RuntimeException setPublicKey ++++++++++++ .. function:: setPublicKey() Setter for the value of the public number :param string: :param string: :rtype: DiffieHellman :throws: \Zend\Crypt\Exception\InvalidArgumentException getPublicKey ++++++++++++ .. function:: getPublicKey() Returns own public key for communication to the second party to this transaction :param string: :rtype: string :throws: \Zend\Crypt\Exception\InvalidArgumentException computeSecretKey ++++++++++++++++ .. function:: computeSecretKey() 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. :param string: :param string: :param string: :rtype: string :throws: \Zend\Crypt\Exception\InvalidArgumentException :throws: \Zend\Crypt\Exception\RuntimeException getSharedSecretKey ++++++++++++++++++ .. function:: getSharedSecretKey() Return the computed shared secret key from the DiffieHellman transaction :param string: :rtype: string :throws: \Zend\Crypt\Exception\InvalidArgumentException setPrime ++++++++ .. function:: setPrime() Setter for the value of the prime number :param string: :rtype: DiffieHellman :throws: \Zend\Crypt\Exception\InvalidArgumentException getPrime ++++++++ .. function:: getPrime() Getter for the value of the prime number :param string: :rtype: string :throws: \Zend\Crypt\Exception\InvalidArgumentException setGenerator ++++++++++++ .. function:: setGenerator() Setter for the value of the generator number :param string: :rtype: DiffieHellman :throws: \Zend\Crypt\Exception\InvalidArgumentException getGenerator ++++++++++++ .. function:: getGenerator() Getter for the value of the generator number :param string: :rtype: string :throws: \Zend\Crypt\Exception\InvalidArgumentException setPrivateKey +++++++++++++ .. function:: setPrivateKey() Setter for the value of the private number :param string: :param string: :rtype: DiffieHellman :throws: \Zend\Crypt\Exception\InvalidArgumentException getPrivateKey +++++++++++++ .. function:: getPrivateKey() Getter for the value of the private number :param string: :rtype: string hasPrivateKey +++++++++++++ .. function:: hasPrivateKey() Check whether a private key currently exists. :rtype: bool convert +++++++ .. function:: convert() Convert number between formats :param $number: :param string: :param string: :rtype: string generatePrivateKey ++++++++++++++++++ .. function:: generatePrivateKey() 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. :rtype: string Constants --------- DEFAULT_KEY_SIZE ++++++++++++++++ FORMAT_BINARY +++++++++++++ Key formats FORMAT_NUMBER +++++++++++++ FORMAT_BTWOC ++++++++++++