diff options
author | Parménides GV <parmegv@sdf.org> | 2014-05-07 13:55:46 +0200 |
---|---|---|
committer | Parménides GV <parmegv@sdf.org> | 2014-05-07 13:55:46 +0200 |
commit | 69c299b9c891d92ff7e5bc87e32b9acb10901b91 (patch) | |
tree | ed99f4c1cd198209331ef374e834f5e388f4fab6 /app/src/debug/java | |
parent | 230ae10fb3a0c08cbd16e91fce041133bdf5ae8e (diff) |
Signup protocol coded. UI next.
Diffstat (limited to 'app/src/debug/java')
-rw-r--r-- | app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java b/app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java index 8678cc80..89ba9135 100644 --- a/app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java +++ b/app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java @@ -212,12 +212,13 @@ public class ProviderAPI extends IntentService { SRPParameters params = new SRPParameters(new BigInteger(ConfigHelper.NG_1024, 16).toByteArray(), ConfigHelper.G.toByteArray(), BigInteger.ZERO.toByteArray(), "SHA-256"); LeapSRPSession client = new LeapSRPSession(username, password, params); - byte[] salted_password = client.calculateSaltedPassword(); + byte[] salt = ConfigHelper.trim(client.calculateNewSalt()); + // byte[] salted_password = client.calculatePasswordHash(username, password, salt); /* Calculate password verifier */ - BigInteger password_verifier = client.calculateV(username, password, salted_password); + BigInteger password_verifier = client.calculateV(username, password, salt); /* Send to the server */ try { - JSONObject result = sendNewUserDataToSRPServer(authentication_server, username, new BigInteger(salted_password).toString(16), password_verifier.toString()); + JSONObject result = sendNewUserDataToSRPServer(authentication_server, username, new BigInteger(1, salt).toString(16), password_verifier.toString(16)); Log.d(TAG, result.toString()); broadcast_progress(progress++); } catch (ClientProtocolException e) { @@ -295,7 +296,7 @@ public class ProviderAPI extends IntentService { if(M1 != null) { broadcast_progress(progress++); JSONObject session_idAndM2 = sendM1ToSRPServer(authentication_server, username, M1); - if(session_idAndM2.has(LeapSRPSession.M2) && client.verify((byte[])session_idAndM2.get(LeapSRPSession.M2))) { + if(session_idAndM2.has(LeapSRPSession.M2) && client.verify((byte[])session_idAndM2.get(LeapSRPSession.M2))) { session_id_bundle.putBoolean(RESULT_KEY, true); broadcast_progress(progress++); } else { @@ -461,15 +462,14 @@ public class ProviderAPI extends IntentService { * @throws KeyStoreException * @throws KeyManagementException */ - private JSONObject sendNewUserDataToSRPServer(String server_url, String username, String salted_password, String password_verifier) throws ClientProtocolException, IOException, JSONException, KeyManagementException, KeyStoreException, NoSuchAlgorithmException, CertificateException { + private JSONObject sendNewUserDataToSRPServer(String server_url, String username, String salt, String password_verifier) throws ClientProtocolException, IOException, JSONException, KeyManagementException, KeyStoreException, NoSuchAlgorithmException, CertificateException { Map<String, String> parameters = new HashMap<String, String>(); parameters.put("user[login]", username); - parameters.put("user[password_salt]", salted_password); + parameters.put("user[password_salt]", salt); parameters.put("user[password_verifier]", password_verifier); - return sendToServer(server_url + "/users.json", "POST", parameters); - - /*HttpPost post = new HttpPost(server_url + "/sessions.json" + "?" + "login=" + username + "&&" + "A=" + clientA); - return sendToServer(post);*/ + Log.d(TAG, server_url); + Log.d(TAG, parameters.toString()); + return sendToServer(server_url + "/users", "POST", parameters); } /** |