summaryrefslogtreecommitdiffstats
path: root/Auth
diff options
context:
space:
mode:
authorJosh Hoyt <josh@janrain.com>2006-01-23 22:11:39 +0000
committerJosh Hoyt <josh@janrain.com>2006-01-23 22:11:39 +0000
commit31972ad02a8f62ee1bb2c14713743c382d731aeb (patch)
tree57d5ca1074ea77b982ee10cd6071de0d002a40d3 /Auth
parentbeec6b61024a17855ee007f5f7d39aea8cf43cb1 (diff)
downloadphp-openid-31972ad02a8f62ee1bb2c14713743c382d731aeb.zip
php-openid-31972ad02a8f62ee1bb2c14713743c382d731aeb.tar.gz
php-openid-31972ad02a8f62ee1bb2c14713743c382d731aeb.tar.bz2
[project @ Remove Auth_OpenID_(from|to)Base64 wrappers]
Diffstat (limited to 'Auth')
-rw-r--r--Auth/OpenID/Association.php6
-rw-r--r--Auth/OpenID/Consumer/Consumer.php8
-rw-r--r--Auth/OpenID/OIDUtil.php17
-rw-r--r--Auth/OpenID/Store/FileStore.php2
4 files changed, 8 insertions, 25 deletions
diff --git a/Auth/OpenID/Association.php b/Auth/OpenID/Association.php
index c055f95..7d3ac2c 100644
--- a/Auth/OpenID/Association.php
+++ b/Auth/OpenID/Association.php
@@ -173,7 +173,7 @@ class Auth_OpenID_Association {
$data = array(
'version' => '2',
'handle' => $this->handle,
- 'secret' => Auth_OpenID_toBase64($this->secret),
+ 'secret' => base64_encode($this->secret),
'issued' => strval(intval($this->issued)),
'lifetime' => strval(intval($this->lifetime)),
'assoc_type' => $this->assoc_type
@@ -222,7 +222,7 @@ class Auth_OpenID_Association {
$issued = intval($issued);
$lifetime = intval($lifetime);
- $secret = Auth_OpenID_fromBase64($secret);
+ $secret = base64_decode($secret);
return new $class_name(
$handle, $secret, $issued, $lifetime, $assoc_type);
@@ -259,7 +259,7 @@ class Auth_OpenID_Association {
$pairs[] = array($field, $data[$prefix . $field]);
}
- return Auth_OpenID_toBase64($this->sign($pairs));
+ return base64_encode($this->sign($pairs));
}
function addSignature($fields, &$data, $prefix = 'openid.')
diff --git a/Auth/OpenID/Consumer/Consumer.php b/Auth/OpenID/Consumer/Consumer.php
index 741b182..64b6188 100644
--- a/Auth/OpenID/Consumer/Consumer.php
+++ b/Auth/OpenID/Consumer/Consumer.php
@@ -755,7 +755,7 @@ class Auth_OpenID_Consumer {
$sig = Auth_OpenID_HMACSHA1($this->store->getAuthKey(),
$joined);
- return Auth_OpenID_toBase64($sig . $joined);
+ return base64_encode($sig . $joined);
}
/**
@@ -765,7 +765,7 @@ class Auth_OpenID_Consumer {
{
global $_Auth_OpenID_TOKEN_LIFETIME;
- $token = Auth_OpenID_fromBase64($token);
+ $token = base64_decode($token);
if (strlen($token) < 20) {
return null;
}
@@ -946,7 +946,7 @@ class Auth_OpenID_Consumer {
$session_type = Auth_OpenID_array_get($results, 'session_type', null);
if ($session_type === null) {
- $secret = Auth_OpenID_fromBase64($results['mac_key']);
+ $secret = base64_decode($results['mac_key']);
} else {
$fmt = 'Unsupported session_type returned from server %s: %s';
if ($session_type != 'DH-SHA1') {
@@ -956,7 +956,7 @@ class Auth_OpenID_Consumer {
$spub = Auth_OpenID_base64ToLong($results['dh_server_public']);
- $enc_mac_key = Auth_OpenID_fromBase64($results['enc_mac_key']);
+ $enc_mac_key = base64_decode($results['enc_mac_key']);
$secret = $dh->xorSecret($spub, $enc_mac_key);
}
diff --git a/Auth/OpenID/OIDUtil.php b/Auth/OpenID/OIDUtil.php
index 7b23bac..f8de56a 100644
--- a/Auth/OpenID/OIDUtil.php
+++ b/Auth/OpenID/OIDUtil.php
@@ -149,23 +149,6 @@ function Auth_OpenID_appendArgs($url, $args)
}
/**
- * Converts the specified string to a base64 representation.
- */
-function Auth_OpenID_toBase64($s)
-{
- return base64_encode($s);
-}
-
-/**
- * Returns the original string representation of the specified
- * base64-encoded string.
- */
-function Auth_OpenID_fromBase64($s)
-{
- return base64_decode($s);
-}
-
-/**
* Turn a string into an ASCII string.
*
* Replace non-ascii characters with a %-encoded, UTF-8 encoding. This
diff --git a/Auth/OpenID/Store/FileStore.php b/Auth/OpenID/Store/FileStore.php
index 61918ca..82bca84 100644
--- a/Auth/OpenID/Store/FileStore.php
+++ b/Auth/OpenID/Store/FileStore.php
@@ -102,7 +102,7 @@ function _isFilenameSafe($char)
function _safe64($str)
{
- $h64 = Auth_OpenID_toBase64(Auth_OpenID_SHA1($str));
+ $h64 = base64_encode(Auth_OpenID_SHA1($str));
$h64 = str_replace('+', '_', $h64);
$h64 = str_replace('/', '.', $h64);
$h64 = str_replace('=', '', $h64);