src/Util/LTI.php
public static function verifyKeyAndSecret($key, $secret, $http_url=NULL, $parameters=null, $http_method=NULL) {
        global $LastOAuthBodyBaseString;
        if ( ! ($key && $secret) ) return array("Missing key or secret", "");
        $store = new TrivialOAuthDataStore();
        $store->add_consumer($key, $secret);

        $server = new OAuthServer($store);

        $method = new OAuthSignatureMethod_HMAC_SHA1();
        $server->add_signature_method($method);
        $method = new OAuthSignatureMethod_HMAC_SHA256();
        $server->add_signature_method($method);

        $request = OAuthRequest::from_request($http_method, $http_url, $parameters);

        $LastOAuthBodyBaseString = $request->get_signature_base_string();

        try {
            $server->verify_request($request);
            return true;
        } catch (\Exception $e) {
            return array($e->getMessage(), $LastOAuthBodyBaseString);
        }
    }
public static function verifyKeyAndSecret($key, $secret, $http_url=NULL, $parameters=null, $http_method=NULL) {
        global $LastOAuthBodyBaseString;
        if ( ! ($key && $secret) ) return array("Missing key or secret", "");
        $store = new TrivialOAuthDataStore();
        $store->add_consumer($key, $secret);

        $server = new OAuthServer($store);

        $method = new OAuthSignatureMethod_HMAC_SHA1();
        $server->add_signature_method($method);
        $method = new OAuthSignatureMethod_HMAC_SHA256();
        $server->add_signature_method($method);

        $request = OAuthRequest::from_request($http_method, $http_url, $parameters);

        $LastOAuthBodyBaseString = $request->get_signature_base_string();

        try {
            $server->verify_request($request);
            return true;
        } catch (\Exception $e) {
            return array($e->getMessage(), $LastOAuthBodyBaseString);
        }
    }
public static function verifyKeyAndSecret ( $ key , $ secret , $ http_url = NULL , $ parameters = null , $ http_method = NULL ) { global $ LastOAuthBodyBaseString ; if ( ! ( $ key && $ secret ) ) return array ( "Missing key or secret" , "" ) ; $ store = new TrivialOAuthDataStore ( ) ; $ store -> add_consumer ( $ key , $ secret ) ; $ server = new OAuthServer ( $ store ) ; $ method = new OAuthSignatureMethod_HMAC_SHA1 ( ) ; $ server -> add_signature_method ( $ method ) ; $ method = new OAuthSignatureMethod_HMAC_SHA256 ( ) ; $ server -> add_signature_method ( $ method ) ; $ request = OAuthRequest :: from_request ( $ http_method , $ http_url , $ parameters ) ; $ LastOAuthBodyBaseString = $ request -> get_signature_base_string ( ) ; try { $ server -> verify_request ( $ request ) ; return true ; } catch ( \ Exception $ e ) { return array ( $ e -> getMessage ( ) , $ LastOAuthBodyBaseString ) ; } }
Verify the message signature for this request

@return mixed This returns true if the request verified.  If the request did not verify,
this returns an array with the first element as an error string, and the second element
as the base string of the request.
Verify the message signature for this request