ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
OAuthSignatureMethod_HMAC_SHA1 Class Reference

The HMAC-SHA1 signature method uses the HMAC-SHA1 signature algorithm as defined in [RFC2104] where the Signature Base String is the text and the key is the concatenated values (each first encoded per Parameter Encoding) of the Consumer Secret and Token Secret, separated by an '&' character (ASCII code 38) even if empty. More...

+ Inheritance diagram for OAuthSignatureMethod_HMAC_SHA1:
+ Collaboration diagram for OAuthSignatureMethod_HMAC_SHA1:

Public Member Functions

 get_name ()
 Needs to return the name of the Signature Method (ie HMAC-SHA1) More...
 
 build_signature ($request, $consumer, $token)
 Build up the signature NOTE: The output of this function MUST NOT be urlencoded. More...
 
- Public Member Functions inherited from OAuthSignatureMethod
 get_name ()
 Needs to return the name of the Signature Method (ie HMAC-SHA1) More...
 
 build_signature ($request, $consumer, $token)
 Build up the signature NOTE: The output of this function MUST NOT be urlencoded. More...
 
 check_signature ($request, $consumer, $token, $signature)
 Verifies that a given signature is correct. More...
 

Detailed Description

The HMAC-SHA1 signature method uses the HMAC-SHA1 signature algorithm as defined in [RFC2104] where the Signature Base String is the text and the key is the concatenated values (each first encoded per Parameter Encoding) of the Consumer Secret and Token Secret, separated by an '&' character (ASCII code 38) even if empty.

  • Chapter 9.2 ("HMAC-SHA1")

Definition at line 128 of file OAuth.php.

Member Function Documentation

◆ build_signature()

OAuthSignatureMethod_HMAC_SHA1::build_signature (   $request,
  $consumer,
  $token 
)

Build up the signature NOTE: The output of this function MUST NOT be urlencoded.

the encoding is handled in OAuthRequest when the final request is serialized

Parameters
OAuthRequest$request
OAuthConsumer$consumer
OAuthToken$token
Returns
string

Reimplemented from OAuthSignatureMethod.

Definition at line 133 of file OAuth.php.

133 {
134 $base_string = $request->get_signature_base_string();
135 $request->base_string = $base_string;
136
137 $key_parts = array(
138 $consumer->secret,
139 ($token) ? $token->secret : ""
140 );
141
142 $key_parts = OAuthUtil::urlencode_rfc3986($key_parts);
143 $key = implode('&', $key_parts);
144
145 return base64_encode(hash_hmac('sha1', $base_string, $key, true));
146 }
static urlencode_rfc3986($input)
Definition: OAuth.php:763
$key
Definition: croninfo.php:18
$consumer
Definition: demo.php:30

References $consumer, $key, and OAuthUtil\urlencode_rfc3986().

+ Here is the call graph for this function:

◆ get_name()

OAuthSignatureMethod_HMAC_SHA1::get_name ( )

Needs to return the name of the Signature Method (ie HMAC-SHA1)

Returns
string

Reimplemented from OAuthSignatureMethod.

Definition at line 129 of file OAuth.php.

129 {
130 return "HMAC-SHA1";
131 }

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