Differences Between: [Versions 311 and 402] [Versions 311 and 403]
1 <?php 2 3 namespace IMSGlobal\LTI\OAuth; 4 5 /** 6 * Class to represent an %OAuth HMAC_SHA1 signature method 7 * 8 * @copyright Andy Smith 9 * @version 2008-08-04 10 * @license https://opensource.org/licenses/MIT The MIT License 11 */ 12 /** 13 * The HMAC-SHA1 signature method uses the HMAC-SHA1 signature algorithm as defined in [RFC2104] 14 * where the Signature Base String is the text and the key is the concatenated values (each first 15 * encoded per Parameter Encoding) of the Consumer Secret and Token Secret, separated by an '&' 16 * character (ASCII code 38) even if empty. 17 * - Chapter 9.2 ("HMAC-SHA1") 18 */ 19 class OAuthSignatureMethod_HMAC_SHA1 extends OAuthSignatureMethod { 20 21 function get_name() { 22 return "HMAC-SHA1"; 23 } 24 25 public function build_signature($request, $consumer, $token) { 26 27 $base_string = $request->get_signature_base_string(); 28 $request->base_string = $base_string; 29 30 $key_parts = array( 31 $consumer->secret, 32 ($token) ? $token->secret : "" 33 ); 34 35 $key_parts = OAuthUtil::urlencode_rfc3986($key_parts); 36 $key = implode('&', $key_parts); 37 38 return base64_encode(hash_hmac('sha1', $base_string, $key, true)); 39 40 } 41 42 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body