Static Public Member Functions | |
static | setSelfUrl ($selfUrl=null) |
static | selfUrl () |
static | absoluteUrl ($url) |
static | paramsToQuery ($params) |
static | normalizeUrl (&$id) |
static | normalize (&$id) |
static | redirect ($url, $params=null, Zend_Controller_Response_Abstract $response=null, $method= 'GET') |
static | randomBytes ($len) |
static | digest ($func, $data) |
static | hashHmac ($macFunc, $data, $secret) |
static | createDhKey ($p, $g, $priv_key=null) |
static | getDhKeyDetails ($dh) |
static | computeDhSecret ($pub_key, $dh) |
static | btwoc ($str) |
static | strlen ($str) |
Data Fields | |
const | DH_P = 'dcf93a0b883972ec0e19989ac5a2ce310e1d37717e8d9571bb7623731866e61ef75a2e27898b057f9891c2e27a639c3f29b60814581cd3b2ca3986d2683705577d45c2e7e52dc81c7a171876e5cea74b1448bfdfaf18828efd2519f14e45e3826634af1949e5b535cc829a483b8a76223e5d490a257f05bdff16f2fb22c583ab' |
const | DH_G = '02' |
const | NS_2_0 = 'http://specs.openid.net/auth/2.0' |
Static Public Attributes | |
static | $exitOnRedirect = true |
static | $selfUrl = null |
Static Protected Member Functions | |
static | binToBigNum ($bin) |
static | bigNumToBin ($bn) |
Definition at line 41 of file OpenId.php.
static absoluteUrl | ( | $ | url ) | [static] |
Returns an absolute URL for the given one
string | $url | absilute or relative URL |
Definition at line 157 of file OpenId.php.
static bigNumToBin | ( | $ | bn ) | [static, protected] |
Converts internal ext/gmp or ext/bcmath big integer representation into binary string.
mixed | $bn | big number |
Zend_OpenId_Exception |
Definition at line 575 of file OpenId.php.
static binToBigNum | ( | $ | bin ) | [static, protected] |
Converts binary representation into ext/gmp or ext/bcmath big integer representation.
string | $bin | binary representation of big number |
Zend_OpenId_Exception |
Definition at line 548 of file OpenId.php.
static btwoc | ( | $ | str ) | [static] |
Takes an arbitrary precision integer and returns its shortest big-endian two's complement representation.
Arbitrary precision integers MUST be encoded as big-endian signed two's complement binary strings. Henceforth, "btwoc" is a function that takes an arbitrary precision integer and returns its shortest big-endian two's complement representation. All integers that are used with Diffie-Hellman Key Exchange are positive. This means that the left-most bit of the two's complement representation MUST be zero. If it is not, implementations MUST add a zero byte at the front of the string.
string | $str | binary representation of arbitrary precision integer |
Definition at line 729 of file OpenId.php.
static computeDhSecret | ( | $ | pub_key, |
$ | dh | ||
) | [static] |
Computes the shared secret from the private DH value $dh and the other party's public value in $pub_key
string | $pub_key | other party's public value |
mixed | $dh | Diffie-Hellman key |
Zend_OpenId_Exception |
Definition at line 691 of file OpenId.php.
static createDhKey | ( | $ | p, |
$ | g, | ||
$ | priv_key = null |
||
) | [static] |
Performs the first step of a Diffie-Hellman key exchange by generating private and public DH values based on given prime number $p and generator $g. Both sides of key exchange MUST have the same prime number and generator. In this case they will able to create a random shared secret that is never send from one to the other.
string | $p | prime number in binary representation |
string | $g | generator in binary representation |
string | $priv_key | private key in binary representation |
Definition at line 623 of file OpenId.php.
static digest | ( | $ | func, |
$ | data | ||
) | [static] |
Generates a hash value (message digest) according to given algorithm. It returns RAW binary string.
This is a wrapper function that uses one of available internal function dependent on given PHP configuration. It may use various functions from ext/openssl, ext/hash, ext/mhash or ext/standard.
string | $func | digest algorithm |
string | $data | data to sign |
Zend_OpenId_Exception |
Definition at line 492 of file OpenId.php.
static getDhKeyDetails | ( | $ | dh ) | [static] |
Returns an associative array with Diffie-Hellman key components in binary representation. The array includes original prime number 'p' and generator 'g', random private key 'priv_key' and corresponding public key 'pub_key'.
mixed | $dh | Diffie-Hellman key |
Definition at line 670 of file OpenId.php.
static hashHmac | ( | $ | macFunc, |
$ | data, | ||
$ | secret | ||
) | [static] |
Generates a keyed hash value using the HMAC method. It uses ext/hash if available or user-level PHP implementation, that is not significantly slower.
string | $macFunc | name of selected hashing algorithm (sha1, sha256) |
string | $data | data to sign |
string | $secret | shared secret key used for generating the HMAC variant of the message digest |
Definition at line 522 of file OpenId.php.
static normalize | ( | &$ | id ) | [static] |
Normalizes OpenID identifier that can be URL or XRI name. Returns true on success and false of failure.
Normalization is performed according to the following rules: 1. If the user's input starts with one of the "xri://", "xri://$ip*", or "xri://$dns*" prefixes, they MUST be stripped off, so that XRIs are used in the canonical form, and URI-authority XRIs are further considered URL identifiers. 2. If the first character of the resulting string is an XRI Global Context Symbol ("=", "@", "+", "$", "!"), then the input SHOULD be treated as an XRI. 3. Otherwise, the input SHOULD be treated as an http URL; if it does not include a "http" or "https" scheme, the Identifier MUST be prefixed with the string "http://". 4. URL identifiers MUST then be further normalized by both following redirects when retrieving their content and finally applying the rules in Section 6 of [RFC3986] to the final destination URL.
string | &$id | identifier to be normalized |
Definition at line 378 of file OpenId.php.
static normalizeUrl | ( | &$ | id ) | [static] |
Normalizes URL according to RFC 3986 to use it in comparison operations. The function gets URL argument by reference and modifies it. It returns true on success and false of failure.
string | &$id | url to be normalized |
Definition at line 218 of file OpenId.php.
static paramsToQuery | ( | $ | params ) | [static] |
Converts variable/value pairs into URL encoded query string
array | $params | variable/value pairs |
Definition at line 198 of file OpenId.php.
static randomBytes | ( | $ | len ) | [static] |
Produces string of random byte of given length.
integer | $len | length of requested string |
Definition at line 470 of file OpenId.php.
static redirect | ( | $ | url, |
$ | params = null , |
||
Zend_Controller_Response_Abstract $ | response = null , |
||
$ | method = 'GET' |
||
) | [static] |
Performs a HTTP redirection to specified URL with additional data. It may generate redirected request using GET or POST HTTP method. The function never returns.
string | $url | URL to redirect to |
array | $params | additional variable/value pairs to send |
Zend_Controller_Response_Abstract | $response | |
string | $method | redirection method ('GET' or 'POST') |
Definition at line 422 of file OpenId.php.
static selfUrl | ( | ) | [static] |
Returns a full URL that was requested on current HTTP request.
Definition at line 89 of file OpenId.php.
static setSelfUrl | ( | $ | selfUrl = null ) |
[static] |
Sets alternative request URL that can be used to override the default selfUrl() response
string | $selfUrl | the URL to be set |
Definition at line 77 of file OpenId.php.
static strlen | ( | $ | str ) | [static] |
Returns lenght of binary string in bytes
string | $str |
Definition at line 743 of file OpenId.php.
$exitOnRedirect = true [static] |
Allows enable/disable stoping execution of PHP script after redirect()
Definition at line 62 of file OpenId.php.
$selfUrl = null [static] |
Alternative request URL that can be used to override the default selfUrl() response
Definition at line 68 of file OpenId.php.
const DH_G = '02' |
Default Diffie-Hellman prime number (should be 2 or 5)
Definition at line 51 of file OpenId.php.
const DH_P = 'dcf93a0b883972ec0e19989ac5a2ce310e1d37717e8d9571bb7623731866e61ef75a2e27898b057f9891c2e27a639c3f29b60814581cd3b2ca3986d2683705577d45c2e7e52dc81c7a171876e5cea74b1448bfdfaf18828efd2519f14e45e3826634af1949e5b535cc829a483b8a76223e5d490a257f05bdff16f2fb22c583ab' |
Default Diffie-Hellman key generator (1024 bit)
Definition at line 46 of file OpenId.php.
const NS_2_0 = 'http://specs.openid.net/auth/2.0' |
OpenID 2.0 namespace. All OpenID 2.0 messages MUST contain variable openid.ns with its value.
Definition at line 57 of file OpenId.php.