src/SignatureVerifier.php
public static function verifyApiResponseSignature($publicId, $version, $signature)
    {
        $paramsArray = ['publicId' => $publicId, 'version' => $version, 'signature' => $signature];

        self::validateParams($paramsArray, self::$API_RESPONSE_VALIDATOR_ALLOWED_TYPES);

        $apiSecret = \Cloudinary::config_get('api_secret');
        self::validateApiSecret($apiSecret);

        $payloadToSign = 'public_id=' . $publicId . '&version=' . $version;
        $hmac = self::generateHmac($payloadToSign, $apiSecret);

        if ($hmac !== $signature) {
            return false;
        }

        return true;
    }
public static function verifyApiResponseSignature($publicId, $version, $signature)
    {
        $paramsArray = ['publicId' => $publicId, 'version' => $version, 'signature' => $signature];

        self::validateParams($paramsArray, self::$API_RESPONSE_VALIDATOR_ALLOWED_TYPES);

        $apiSecret = \Cloudinary::config_get('api_secret');
        self::validateApiSecret($apiSecret);

        $payloadToSign = 'public_id=' . $publicId . '&version=' . $version;
        $hmac = self::generateHmac($payloadToSign, $apiSecret);

        if ($hmac !== $signature) {
            return false;
        }

        return true;
    }
public static function verifyApiResponseSignature ( $ publicId , $ version , $ signature ) { $ paramsArray = [ 'publicId' => $ publicId , 'version' => $ version , 'signature' => $ signature ] ; self :: validateParams ( $ paramsArray , self :: $ API_RESPONSE_VALIDATOR_ALLOWED_TYPES ) ; $ apiSecret = \ Cloudinary :: config_get ( 'api_secret' ) ; self :: validateApiSecret ( $ apiSecret ) ; $ payloadToSign = 'public_id=' . $ publicId . '&version=' . $ version ; $ hmac = self :: generateHmac ( $ payloadToSign , $ apiSecret ) ; if ( $ hmac !== $ signature ) { return false ; } return true ; }
Verifies the authenticity of an API response signature

@param string        $publicId  The public id of the asset as returned in the API response
@param int|string    $version    The version of the asset as returned in the API response
@param string        $signature  Actual signature. Can be retrieved from the X-Cld-Signature header

@return boolean

@throws \InvalidArgumentException in case a mandatory parameter is empty or of wrong type
Verifies the authenticity of an API response signature