summaryrefslogtreecommitdiff
path: root/src/se/leap/leapclient/LeapSRPSession.java
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2013-06-19 19:05:12 +0200
committerParménides GV <parmegv@sdf.org>2013-06-19 19:05:12 +0200
commitd475ae617d8dc0994a1294be7c8cca338a68fd9e (patch)
treee024cddb5d030ac423f321b8293449afe094e6cb /src/se/leap/leapclient/LeapSRPSession.java
parentbffd21a326bcb86d814dd3fe2caf5295ea705f2d (diff)
First round of comments.
This resolves the first step from issue #2908. Next step: Put user message strings into an appropiate place.
Diffstat (limited to 'src/se/leap/leapclient/LeapSRPSession.java')
-rw-r--r--src/se/leap/leapclient/LeapSRPSession.java19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/se/leap/leapclient/LeapSRPSession.java b/src/se/leap/leapclient/LeapSRPSession.java
index 0a8e735f..beb286da 100644
--- a/src/se/leap/leapclient/LeapSRPSession.java
+++ b/src/se/leap/leapclient/LeapSRPSession.java
@@ -9,6 +9,14 @@ import java.util.Arrays;
import org.jboss.security.Util;
import org.jboss.security.srp.SRPParameters;
+/**
+ * Implements all SRP algorithm logic.
+ *
+ * It's derived from JBoss implementation, with adjustments to make it work with LEAP platform.
+ *
+ * @author parmegv
+ *
+ */
public class LeapSRPSession {
private SRPParameters params;
@@ -133,7 +141,14 @@ public class LeapSRPSession {
return v;
}
- public byte[] xor(byte[] b1, byte[] b2, int length)
+ /**
+ * Calculates the trimmed xor from two BigInteger numbers
+ * @param b1 the positive source to build first BigInteger
+ * @param b2 the positive source to build second BigInteger
+ * @param length
+ * @return
+ */
+ public byte[] xor(byte[] b1, byte[] b2)
{
//TODO Check if length matters in the order, when b2 is smaller than b1 or viceversa
byte[] xor_digest = new BigInteger(1, b1).xor(new BigInteger(1, b2)).toByteArray();
@@ -185,7 +200,7 @@ public class LeapSRPSession {
byte[] digest_of_g = newDigest().digest(params.g);
// clientHash = H(N) xor H(g)
- byte[] xor_digest = xor(digest_of_n, digest_of_g, digest_of_g.length);
+ byte[] xor_digest = xor(digest_of_n, digest_of_g);
clientHash.update(xor_digest);
// clientHash = H(N) xor H(g) | H(U)