LTI Integration Library 4.10.3
PHP class library for building LTI integrations
 
Loading...
Searching...
No Matches
OAuthSignatureMethod_HMAC_SHA256.php
1<?php
2
3namespace ceLTIc\LTI\OAuth;
4
21{
22
28 function get_name()
29 {
30 return "HMAC-SHA256";
31 }
32
46 public function build_signature($request, $consumer, $token)
47 {
48 $base_string = $request->get_signature_base_string();
49 $request->base_string = $base_string;
50
51 $key_parts = array(
52 $consumer->secret,
53 ($token) ? $token->secret : ""
54 );
55
56 $key_parts = OAuthUtil::urlencode_rfc3986($key_parts);
57 $key = implode('&', $key_parts);
58
59 return base64_encode(hash_hmac('sha256', $base_string, $key, true));
60 }
61
62}
Class to represent an OAuth HMAC_SHA256 signature method.
build_signature($request, $consumer, $token)
Build up the signature.
Class to represent an OAuth signature method.
static urlencode_rfc3986($input)
URL encode.
Definition OAuthUtil.php:22