diff options
author | Parménides GV <parmegv@sdf.org> | 2013-06-05 18:57:55 +0200 |
---|---|---|
committer | Parménides GV <parmegv@sdf.org> | 2013-06-05 18:57:55 +0200 |
commit | d74a3ae14a27893572d170c138e18522b541866a (patch) | |
tree | 6ba72c34a97853b640ba0bb907ae99b428631bbd /src/se | |
parent | 611bb7869ea6a98fe656b6e86ef98118d232fd45 (diff) |
Fixed passwords with \ character.
The substitution I was doing let me to pass my tests localhost, but was
not valid for real use in Android emulator.
This was so because JSONObject getString method understood \/ simply as
/, while what I wanted was plain \/.
This commit makes #2368
Diffstat (limited to 'src/se')
-rw-r--r-- | src/se/leap/leapclient/LeapSRPSession.java | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/src/se/leap/leapclient/LeapSRPSession.java b/src/se/leap/leapclient/LeapSRPSession.java index 77f43945..47dff276 100644 --- a/src/se/leap/leapclient/LeapSRPSession.java +++ b/src/se/leap/leapclient/LeapSRPSession.java @@ -90,10 +90,10 @@ public class LeapSRPSession { */ public byte[] calculatePasswordHash(String username, String password, byte[] salt) { - password = password.replaceAll("\\\\", "\\\\\\\\"); + //password = password.replaceAll("\\\\", "\\\\\\\\"); // Calculate x = H(s | H(U | ':' | password)) MessageDigest x_digest = newDigest(); - // Try to convert the username to a byte[] using UTF-8 + // Try to convert the username to a byte[] using ISO-8859-1 byte[] user = null; byte[] password_bytes = null; byte[] colon = {}; @@ -110,29 +110,12 @@ public class LeapSRPSession { password_bytes = Util.trim(password.getBytes()); } - /*byte[] passBytes = new byte[2*password.toCharArray().length]; - int passBytesLength = 0; - for(int p = 0; p < password.toCharArray().length; p++) { - int c = (password.toCharArray()[p] & 0x00FFFF); - // The low byte of the char - byte b0 = (byte) (c & 0x0000FF); - // The high byte of the char - byte b1 = (byte) ((c & 0x00FF00) >> 8); - passBytes[passBytesLength ++] = b0; - // Only encode the high byte if c is a multi-byte char - if( c > 255 ) - passBytes[passBytesLength ++] = b1; - }*/ - // Build the hash x_digest.update(user); x_digest.update(colon); x_digest.update(password_bytes); - //x_digest.update(passBytes, 0, passBytesLength); byte[] h = x_digest.digest(); - String hstr = new BigInteger(1, h).toString(16); - //h = Util.trim(h); - //25c19c2b903ff36dd5acd6e1136b8f3af008ceee45103ef9771334f4246d6226 + x_digest.reset(); x_digest.update(salt); x_digest.update(h); |