XMPPDiscoEntity: Caps hash must be Base64 encoded SHA1
This commit is contained in:
parent
bd0440b3ee
commit
bfdfabcf40
1 changed files with 10 additions and 2 deletions
|
@ -90,10 +90,12 @@
|
||||||
|
|
||||||
- (OFString*)capsHash
|
- (OFString*)capsHash
|
||||||
{
|
{
|
||||||
OFMutableString *caps = [OFMutableString string];
|
|
||||||
OFEnumerator *enumerator;
|
OFEnumerator *enumerator;
|
||||||
XMPPDiscoIdentity *identity;
|
XMPPDiscoIdentity *identity;
|
||||||
OFString *feature;
|
OFString *feature;
|
||||||
|
OFMutableString *caps = [OFMutableString string];
|
||||||
|
OFSHA1Hash *hash = [OFSHA1Hash hash];
|
||||||
|
OFDataArray *digest = [OFDataArray dataArray];
|
||||||
|
|
||||||
enumerator = [_identities objectEnumerator];
|
enumerator = [_identities objectEnumerator];
|
||||||
while ((identity = [enumerator nextObject]) != nil)
|
while ((identity = [enumerator nextObject]) != nil)
|
||||||
|
@ -104,7 +106,13 @@
|
||||||
while ((feature = [enumerator nextObject]) != nil)
|
while ((feature = [enumerator nextObject]) != nil)
|
||||||
[caps appendFormat: @"%@<", feature];
|
[caps appendFormat: @"%@<", feature];
|
||||||
|
|
||||||
return [caps SHA1Hash];
|
[hash updateWithBuffer: [caps UTF8String]
|
||||||
|
length: [caps UTF8StringLength]];
|
||||||
|
|
||||||
|
[digest addItems: [hash digest]
|
||||||
|
count: [OFSHA1Hash digestSize]];
|
||||||
|
|
||||||
|
return [digest stringByBase64Encoding];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)connection: (XMPPConnection*)connection
|
- (void)connection: (XMPPConnection*)connection
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue