Closed
Description
File: JWT.php
$key = "secret";
$payload= ["id" => 1, "name" => "foo"];
$jwt = JWT::encode( $payload, $key );
Encoding the payload will genrate this JWT
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6MSwibmFtZSI6ImZvbyJ9.Q4Kee9E8o0Xfo4ADXvYA8t7dN_X_bU9K5w6tXuiSjlU
The error arise when I add two extra digits to the signature ( and only two digits )
$fake = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6MSwibmFtZSI6ImZvbyJ9.Q4Kee9E8o0Xfo4ADXvYA8t7dN_X_bU9K5w6tXuiSjlUxx";
print_r( JWT::decode( $fake, $key, ['HS256'] ));
The code above will report a warning
Warning: hash_equals(): Expected known_string to be a string, boolean given in vendor/firebasephp-jwt/src/JWT.php on line 237
Metadata
Metadata
Assignees
Labels
No labels