ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
OAuthSignatureMethod_HMAC_SHA256.php
Go to the documentation of this file.
1<?php
2
3namespace IMSGlobal\LTI\OAuth;
4
21
22 function get_name() {
23 return "HMAC-SHA256";
24 }
25
26 public function build_signature($request, $consumer, $token) {
27
28 $base_string = $request->get_signature_base_string();
29 $request->base_string = $base_string;
30
31 $key_parts = array(
32 $consumer->secret,
33 ($token) ? $token->secret : ""
34 );
35
36 $key_parts = OAuthUtil::urlencode_rfc3986($key_parts);
37 $key = implode('&', $key_parts);
38
39 return base64_encode(hash_hmac('sha256', $base_string, $key, true));
40
41 }
42
43}
An exception for terminatinating execution or to throw for unit testing.
Class to represent an OAuth HMAC_SHA256 signature method.
build_signature($request, $consumer, $token)
Build up the signature NOTE: The output of this function MUST NOT be urlencoded.
get_name()
Needs to return the name of the Signature Method (ie HMAC-SHA1)
Class to represent an OAuth Signature Method.
static urlencode_rfc3986($input)
Definition: OAuthUtil.php:14
$key
Definition: croninfo.php:18
$consumer
Definition: demo.php:30