Section 2 of RFC 2104 defines the key used in HMAC should be padded with zero bytes up to the block length of the underlying hash algorithm. Isn't this a potential security vulnerability since any key ending in a zero byte would produce the same result as a key without that last byte?
The following PHP code illustrates the example:
$key = "key";
$message = "message";
var_dump(hash_hmac("SHA256", $message, $key));
var_dump(hash_hmac("SHA256", $message, $key.chr(0x00)));
and produces the following output:
string(64) "6e9ef29b75fffc5b7abae527d58fdadb2fe42e7219011976917343065f58ed4a"
string(64) "6e9ef29b75fffc5b7abae527d58fdadb2fe42e7219011976917343065f58ed4a"
I'm aware that section 3 of the same RFC recommends keys of a minimum length, which would eliminate this problem, as would some sort of hashed key generation step. However, it seems to me this could be a potential problem, or am I being overly paranoid?