summaryrefslogtreecommitdiff
path: root/app/src/main/java/se/leap/bitmaskclient/LeapSRPSession.java
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2014-05-05 16:06:53 +0200
committerParménides GV <parmegv@sdf.org>2014-05-05 16:06:53 +0200
commit230ae10fb3a0c08cbd16e91fce041133bdf5ae8e (patch)
tree37ab910d47817399301aed25374d5c9fd37cb22c /app/src/main/java/se/leap/bitmaskclient/LeapSRPSession.java
parent3ab74308e7ba1fda02d3427ec795eac397707199 (diff)
New menu option: signup.
There is some problem in the maths, because the server says it's ok but login doesn't work from Android app nor from webapp.
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/LeapSRPSession.java')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/LeapSRPSession.java9
1 files changed, 4 insertions, 5 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/LeapSRPSession.java b/app/src/main/java/se/leap/bitmaskclient/LeapSRPSession.java
index db091300..8d95cdb8 100644
--- a/app/src/main/java/se/leap/bitmaskclient/LeapSRPSession.java
+++ b/app/src/main/java/se/leap/bitmaskclient/LeapSRPSession.java
@@ -172,9 +172,11 @@ public class LeapSRPSession {
* Calculates the parameter V of the SRP-6a algorithm.
* @return the value of V
*/
- public BigInteger calculateV() {
+ public BigInteger calculateV(String username, String password, byte[] salt) {
String k_string = "bf66c44a428916cad64aa7c679f3fd897ad4c375e9bbb4cbf2f5de241d618ef0";
BigInteger k = new BigInteger(k_string, 16);
+ byte[] x_bytes = calculatePasswordHash(username, password, ConfigHelper.trim(salt));
+ x = new BigInteger(1, x_bytes);
BigInteger v = k.multiply(g.modPow(x, N)); // g^x % N
return v;
}
@@ -226,11 +228,8 @@ public class LeapSRPSession {
// Calculate x = H(s | H(U | ':' | password))
byte[] M1 = null;
if(new BigInteger(1, Bbytes).mod(new BigInteger(1, N_bytes)) != BigInteger.ZERO) {
- byte[] xb = calculatePasswordHash(username, password, ConfigHelper.trim(salt_bytes));
- this.x = new BigInteger(1, xb);
-
// Calculate v = kg^x mod N
- this.v = calculateV();
+ this.v = calculateV(username, password, salt_bytes);
// H(N)
byte[] digest_of_n = newDigest().digest(N_bytes);