summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authortailor <cygnus@janrain.com>2006-04-19 22:31:24 +0000
committertailor <cygnus@janrain.com>2006-04-19 22:31:24 +0000
commit94525f21f2c507b9c10e8180ce6de4667f5e66a5 (patch)
treead733fddb4d16756fcdd520501acbb58941d55fc /Tests
parentf00e38a4f9984ba432a73aa1c791ff7ad196f781 (diff)
downloadphp-openid-94525f21f2c507b9c10e8180ce6de4667f5e66a5.zip
php-openid-94525f21f2c507b9c10e8180ce6de4667f5e66a5.tar.gz
php-openid-94525f21f2c507b9c10e8180ce6de4667f5e66a5.tar.bz2
[project @ Turned server DH tests off if no bigmath available]
Diffstat (limited to 'Tests')
-rw-r--r--Tests/Auth/OpenID/Server.php34
1 files changed, 18 insertions, 16 deletions
diff --git a/Tests/Auth/OpenID/Server.php b/Tests/Auth/OpenID/Server.php
index 393dc4c..34cfce6 100644
--- a/Tests/Auth/OpenID/Server.php
+++ b/Tests/Auth/OpenID/Server.php
@@ -836,44 +836,46 @@ class Tests_Auth_OpenID_Associate extends PHPUnit_TestCase {
function test_dh()
{
- $dh = new Auth_OpenID_DiffieHellman();
- $ml =& Auth_OpenID_getMathLib();
-
- $this->request->session_type = 'DH-SHA1';
- $this->request->pubkey = $dh->public;
- $response = $this->request->answer($this->assoc);
- $this->assertEquals(
+ if (!defined('Auth_OpenID_NO_MATH_SUPPORT')) {
+ $dh = new Auth_OpenID_DiffieHellman();
+ $ml =& Auth_OpenID_getMathLib();
+
+ $this->request->session_type = 'DH-SHA1';
+ $this->request->pubkey = $dh->public;
+ $response = $this->request->answer($this->assoc);
+ $this->assertEquals(
Auth_OpenID::arrayGet($response->fields, "assoc_type"),
"HMAC-SHA1");
- $this->assertEquals(
+ $this->assertEquals(
Auth_OpenID::arrayGet($response->fields, "assoc_handle"),
$this->assoc->handle);
- $this->assertFalse(
+ $this->assertFalse(
Auth_OpenID::arrayGet($response->fields, "mac_key"));
- $this->assertEquals(
+ $this->assertEquals(
Auth_OpenID::arrayGet($response->fields, "session_type"),
"DH-SHA1");
- $this->assertTrue(
+ $this->assertTrue(
Auth_OpenID::arrayGet($response->fields, "enc_mac_key"));
- $this->assertTrue(
+ $this->assertTrue(
Auth_OpenID::arrayGet($response->fields,
"dh_server_public"));
- $enc_key = base64_decode(
+ $enc_key = base64_decode(
Auth_OpenID::arrayGet($response->fields, "enc_mac_key"));
- $spub = $ml->base64ToLong(
+ $spub = $ml->base64ToLong(
Auth_OpenID::arrayGet($response->fields,
"dh_server_public"));
- $secret = $dh->xorSecret($spub, $enc_key);
+ $secret = $dh->xorSecret($spub, $enc_key);
- $this->assertEquals($secret, $this->assoc->secret);
+ $this->assertEquals($secret, $this->assoc->secret);
+ }
}
function test_plaintext()