nsx_trOAuthSignatureMethod_HMAC_SHA1

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.

Defined (1)

The class is defined in the following location(s).

/inc-cl/apis/OAuth.php  
  1. class nsx_trOAuthSignatureMethod_HMAC_SHA1 extends nsx_trOAuthSignatureMethod { 
  2. function get_name() { 
  3. return "HMAC-SHA1"; 
  4.  
  5. public function build_signature($request, $consumer, $token) { 
  6. $base_string = $request->get_signature_base_string(); 
  7. $request->base_string = $base_string; 
  8.  
  9. $key_parts = array( 
  10. $consumer->secret,  
  11. ($token) ? $token->secret : "" 
  12. ); 
  13.  
  14. $key_parts = nsx_trOAuthUtil::urlencode_rfc3986($key_parts); 
  15. $key = implode('&', $key_parts); 
  16.  
  17. return base64_encode(hash_hmac('sha1', $base_string, $key, true));