1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-10 17:49:38 +02:00

Add SCRAM-SHA1 support

Thanks to Stefan Karlsson for helping with the implementation.

Also add SASLMechanism.checkIfSuccessfulOrThrow(), to increase the
security by verifying the mechanisms state at the end of SASL
authentication.

SASLMechanism now has a SASLPrep StringTransformer.

Refactor SHA1 functions out of StringUtils into SHA1 utility class.

Add MAC utility class.

Make DummyConnection getSentpacket() methods use generics to make unit
testing SCRAM-SHA1 easier.

Fixes SMACK-398
This commit is contained in:
Florian Schmaus 2014-10-21 11:59:11 +02:00
parent 6a2bc0c02d
commit 403ecff2b2
18 changed files with 704 additions and 80 deletions

View file

@ -20,7 +20,7 @@ import java.io.DataInputStream;
import java.io.IOException;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smack.util.SHA1;
/**
* A collection of utility methods for SOcKS5 messages.
@ -41,7 +41,7 @@ class Socks5Utils {
public static String createDigest(String sessionID, String initiatorJID, String targetJID) {
StringBuilder b = new StringBuilder();
b.append(sessionID).append(initiatorJID).append(targetJID);
return StringUtils.hash(b.toString());
return SHA1.hex(b.toString());
}
/**