mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-26 00:02:06 +01:00
Ensure that the hash value is put in lowercase on the wire
This commit is contained in:
parent
8bfc887f63
commit
4c2d5d797a
1 changed files with 5 additions and 0 deletions
|
@ -596,9 +596,14 @@ public class EntityCapsManager extends Manager {
|
||||||
if (hash == null) {
|
if (hash == null) {
|
||||||
hash = DEFAULT_HASH;
|
hash = DEFAULT_HASH;
|
||||||
}
|
}
|
||||||
|
// SUPPORTED_HASHES uses the format of MessageDigest, which is uppercase, e.g. "SHA-1" instead of "sha-1"
|
||||||
MessageDigest md = SUPPORTED_HASHES.get(hash.toUpperCase(Locale.US));
|
MessageDigest md = SUPPORTED_HASHES.get(hash.toUpperCase(Locale.US));
|
||||||
if (md == null)
|
if (md == null)
|
||||||
return null;
|
return null;
|
||||||
|
// Then transform the hash to lowercase, as this value will be put on the wire within the caps element's hash
|
||||||
|
// attribute. I'm not sure if the standard is case insensitive here, but let's assume that even it is, there could
|
||||||
|
// be "broken" implementation in the wild, so we *always* transform to lowercase.
|
||||||
|
hash = hash.toLowerCase(Locale.US);
|
||||||
|
|
||||||
DataForm extendedInfo = DataForm.from(discoverInfo);
|
DataForm extendedInfo = DataForm.from(discoverInfo);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue