diff options
Diffstat (limited to 'app/src/androidTest/java')
-rw-r--r-- | app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java (renamed from app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboard.java) | 31 | ||||
-rw-r--r-- | app/src/androidTest/java/se/leap/bitmaskclient/test/testEIP.java | 32 | ||||
-rw-r--r-- | app/src/androidTest/java/se/leap/bitmaskclient/test/testLeapSRPSession.java | 52 |
3 files changed, 78 insertions, 37 deletions
diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboard.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java index fdf4f135..94cb67a3 100644 --- a/app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboard.java +++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java @@ -15,11 +15,11 @@ import se.leap.bitmaskclient.Dashboard; import se.leap.bitmaskclient.R; import se.leap.bitmaskclient.test.ConnectionManager; -public class testDashboard extends ActivityInstrumentationTestCase2<Dashboard> { +public class testDashboardIntegration extends ActivityInstrumentationTestCase2<Dashboard> { private Solo solo; - public testDashboard() { + public testDashboardIntegration() { super(Dashboard.class); } @@ -123,4 +123,31 @@ public class testDashboard extends ActivityInstrumentationTestCase2<Dashboard> { solo.waitForActivity(ConfigurationWizard.class); solo.goBack(); } + + public void testUpdateExpiredCertificate() { + String certificate = "-----BEGIN CERTIFICATE-----" + + "MIIEnDCCAoSgAwIBAgIRAOBkcbMKR0Jlw+xNalHn7aIwDQYJKoZIhvcNAQELBQAwdTEYMBYGA1UE" + + "CgwPUmlzZXVwIE5ldHdvcmtzMRswGQYDVQQLDBJodHRwczovL3Jpc2V1cC5uZXQxPDA6BgNVBAMM" + + "M1Jpc2V1cCBOZXR3b3JrcyBSb290IENBIChjbGllbnQgY2VydGlmaWNhdGVzIG9ubHkhKTAeFw0x" + + "NDA5MTkwMDAwMDBaFw0xNDExMTkwMDAwMDBaMC0xKzApBgNVBAMMIlVOTElNSVR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" + + "ADtESsmBvzUEGqxk5GL4lmmeqE+vsR5TesqGjZ+yH67rR+1+Uy2mhbqJBP0E0LHwWCCPYEVfngHj" + + "aZkDF1UVQdfc9Amc5u5J5YliWrEG80BNeJF7740Gwx69DHEIhElN+BBeeqLLYIZTKmt28/9iWbKL" + + "vhCrz/29wLYksL1bXmyHzvzyAcDHPpO9sQrKYiP1mGRDmXJmZU3i3cgeqQFZ8+lr55wcYdMGJOcx" + + "bz+jL0VkHdnoZdzGzelrAhZtgMtsJ/kgWYRgtFmhpYF1Xtj2MYrpBDxgQck=" + + "-----END CERTIFICATE-----"; + + } } diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/testEIP.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/testEIP.java new file mode 100644 index 00000000..4e1819d0 --- /dev/null +++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/testEIP.java @@ -0,0 +1,32 @@ +package se.leap.bitmaskclient.test; + +import android.content.Context; +import android.content.Intent; +import android.test.ActivityUnitTestCase; +import android.test.ServiceTestCase; + +import se.leap.bitmaskclient.Dashboard; +import se.leap.bitmaskclient.eip.EIP; + +public class testEIP extends ServiceTestCase<EIP> { + + private Context context; + private Intent intent; + private EIP activity; + + public testEIP(Class<EIP> activityClass) { + super(activityClass); + } + + @Override + protected void setUp() throws Exception { + super.setUp(); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + } + + +} diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/testLeapSRPSession.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/testLeapSRPSession.java index 2821373a..d7f4bfb3 100644 --- a/app/src/androidTest/java/se/leap/bitmaskclient/test/testLeapSRPSession.java +++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/testLeapSRPSession.java @@ -33,7 +33,6 @@ public class testLeapSRPSession extends TestCase { public void testExponential() { byte[] expected_A; byte[] a_byte; - SRPParameters params; LeapSRPSession client; /* Test 1: abytes = 4 */ @@ -43,8 +42,7 @@ public class testLeapSRPSession extends TestCase { salt = "64c3289d04a6ecad", a = "3565fdc2"; a_byte = new BigInteger(a, 16).toByteArray(); - params = new SRPParameters(new BigInteger(ConfigHelper.NG_1024, 16).toByteArray(), new BigInteger("2").toByteArray(), new BigInteger(salt, 16).toByteArray(), "SHA-256"); - client = new LeapSRPSession(username, password, params, a_byte); + client = new LeapSRPSession(username, password, a_byte); byte[] A = client.exponential(); @@ -55,8 +53,7 @@ public class testLeapSRPSession extends TestCase { expected_A = new BigInteger("11acfacc08178d48f95c0e69adb11f6d144dd0980ee6e44b391347592e3bd5e9cb841d243b3d9ac2adb25b367a2558e8829b22dcef96c0934378412383ccf95141c3cb5f17ada20f53a0225f56a07f2b0c0469ed6bbad3646f7b71bdd4bedf5cc6fac244b26d3195d8f55877ff94a925b0c0c8f7273eca733c0355b38360442e", 16).toByteArray(); a_byte = new BigInteger(a, 16).toByteArray(); - params = new SRPParameters(new BigInteger(ConfigHelper.NG_1024, 16).toByteArray(), new BigInteger("2").toByteArray(), new BigInteger(salt, 16).toByteArray(), "SHA-256"); - client = new LeapSRPSession(username, password, params, a_byte); + client = new LeapSRPSession(username, password, a_byte); A = client.exponential(); @@ -73,8 +70,7 @@ public class testLeapSRPSession extends TestCase { salt = "64c3289d04a6ecad", a = "8c911355"; byte[] a_byte = new BigInteger(a, 16).toByteArray(); - SRPParameters params = new SRPParameters(new BigInteger(ConfigHelper.NG_1024, 16).toByteArray(), new BigInteger("2").toByteArray(), new BigInteger(salt, 16).toByteArray(), "SHA-256"); - LeapSRPSession client = new LeapSRPSession(username, password, params, a_byte); + LeapSRPSession client = new LeapSRPSession(username, password, a_byte); byte[] x = client.calculatePasswordHash(username, password, new BigInteger(salt, 16).toByteArray()); assertTrue(Arrays.equals(x, expected_x)); @@ -93,8 +89,7 @@ public class testLeapSRPSession extends TestCase { a = "38d5b211"; a_byte = new BigInteger(a, 16).toByteArray(); - params = new SRPParameters(new BigInteger(ConfigHelper.NG_1024, 16).toByteArray(), new BigInteger("2").toByteArray(), new BigInteger(salt, 16).toByteArray(), "SHA-256"); - client = new LeapSRPSession(username, password, params, a_byte); + client = new LeapSRPSession(username, password, a_byte); x = client.calculatePasswordHash(username, password, new BigInteger(salt, 16).toByteArray()); A = client.exponential(); @@ -110,8 +105,7 @@ public class testLeapSRPSession extends TestCase { a = "36ee80ec"; a_byte = new BigInteger(a, 16).toByteArray(); - params = new SRPParameters(new BigInteger(ConfigHelper.NG_1024, 16).toByteArray(), new BigInteger("2").toByteArray(), new BigInteger(salt, 16).toByteArray(), "SHA-256"); - client = new LeapSRPSession(username, password, params, a_byte); + client = new LeapSRPSession(username, password, a_byte); x = client.calculatePasswordHash(username, password, new BigInteger(salt, 16).toByteArray()); A = client.exponential(); @@ -321,8 +315,7 @@ public class testLeapSRPSession extends TestCase { salt = "64c3289d04a6ecad", a = "8c911355"; byte[] a_byte = new BigInteger(a, 16).toByteArray(); - SRPParameters params = new SRPParameters(new BigInteger(ConfigHelper.NG_1024, 16).toByteArray(), new BigInteger("2").toByteArray(), new BigInteger(salt, 16).toByteArray(), "SHA-256"); - LeapSRPSession client = new LeapSRPSession(username, password, params, a_byte); + LeapSRPSession client = new LeapSRPSession(username, password, a_byte); byte[] x = client.calculatePasswordHash(username, password, new BigInteger(salt, 16).toByteArray()); assertTrue(Arrays.equals(x, expected_x)); @@ -345,8 +338,7 @@ public class testLeapSRPSession extends TestCase { expected_M2 = trim(new BigInteger("517278a03a0320a52dcb391caf5264d76149d7d9b71ed2b65536233344c550cf", 16).toByteArray()); a_byte = new BigInteger(a, 16).toByteArray(); - params = new SRPParameters(new BigInteger(ConfigHelper.NG_1024, 16).toByteArray(), new BigInteger("2").toByteArray(), new BigInteger(salt, 16).toByteArray(), "SHA-256"); - client = new LeapSRPSession(username, password, params, a_byte); + client = new LeapSRPSession(username, password, a_byte); x = client.calculatePasswordHash(username, password, new BigInteger(salt, 16).toByteArray()); A = client.exponential(); @@ -365,8 +357,7 @@ public class testLeapSRPSession extends TestCase { expected_M2 = trim(new BigInteger("3bfb91c7d04b6da6381fe3d2648d992cdc6bc67b8ee16d1cfa733f786d492261", 16).toByteArray()); a_byte = new BigInteger(a, 16).toByteArray(); - params = new SRPParameters(new BigInteger(ConfigHelper.NG_1024, 16).toByteArray(), new BigInteger("2").toByteArray(), new BigInteger(salt, 16).toByteArray(), "SHA-256"); - client = new LeapSRPSession(username, password, params, a_byte); + client = new LeapSRPSession(username, password, a_byte); x = client.calculatePasswordHash(username, password, new BigInteger(salt, 16).toByteArray()); A = client.exponential(); @@ -390,8 +381,7 @@ public class testLeapSRPSession extends TestCase { expected_M2 = trim(new BigInteger("8f4552b1021a4de621d8f50f0921c4d20651e702d9d71276f8f6c15b838de018", 16).toByteArray()); a_byte = new BigInteger(a, 16).toByteArray(); - params = new SRPParameters(new BigInteger(ConfigHelper.NG_1024, 16).toByteArray(), new BigInteger("2").toByteArray(), new BigInteger(salt, 16).toByteArray(), "SHA-256"); - client = new LeapSRPSession(username, password, params, a_byte); + client = new LeapSRPSession(username, password, a_byte); x = client.calculatePasswordHash(username, password, trim(new BigInteger(salt, 16).toByteArray())); assertTrue(Arrays.equals(x, expected_x)); @@ -418,8 +408,7 @@ public class testLeapSRPSession extends TestCase { expected_M2 = trim(new BigInteger("04cf3ab3b75dbc4b116ca2fec949bf3deca1e360e016d7ab2b8a49904c534a27", 16).toByteArray()); a_byte = new BigInteger(a, 16).toByteArray(); - params = new SRPParameters(new BigInteger(ConfigHelper.NG_1024, 16).toByteArray(), new BigInteger("2").toByteArray(), new BigInteger(salt, 16).toByteArray(), "SHA-256"); - client = new LeapSRPSession(username, password, params, a_byte); + client = new LeapSRPSession(username, password, a_byte); x = client.calculatePasswordHash(username, password, trim(new BigInteger(salt, 16).toByteArray())); assertTrue(Arrays.equals(x, expected_x)); @@ -448,8 +437,7 @@ public class testLeapSRPSession extends TestCase { expected_M2 = trim(new BigInteger("082cf49ad5a34cc5ca571e3d063aec4bd96e7b96a6d951295180631650a84587", 16).toByteArray()); a_byte = new BigInteger(a, 16).toByteArray(); - params = new SRPParameters(new BigInteger(ConfigHelper.NG_1024, 16).toByteArray(), new BigInteger("2").toByteArray(), new BigInteger(salt, 16).toByteArray(), "SHA-256"); - client = new LeapSRPSession(username, password, params, a_byte); + client = new LeapSRPSession(username, password, a_byte); x = client.calculatePasswordHash(username, password, trim(new BigInteger(salt, 16).toByteArray())); assertTrue(Arrays.equals(x, expected_x)); @@ -479,8 +467,7 @@ public class testLeapSRPSession extends TestCase { expected_M2 = trim(new BigInteger("5cc3d7f0077e978c83acdef14a725af01488c1728f0cf32cd7013d24faf5d901", 16).toByteArray()); a_byte = new BigInteger(a, 16).toByteArray(); - params = new SRPParameters(new BigInteger(ConfigHelper.NG_1024, 16).toByteArray(), new BigInteger("2").toByteArray(), new BigInteger(salt, 16).toByteArray(), "SHA-256"); - client = new LeapSRPSession(username, password, params, a_byte); + client = new LeapSRPSession(username, password, a_byte); x = client.calculatePasswordHash(username, password, trim(new BigInteger(salt, 16).toByteArray())); assertTrue(Arrays.equals(x, expected_x)); @@ -510,8 +497,7 @@ public class testLeapSRPSession extends TestCase { expected_M2 = trim(new BigInteger("d78da7e0a23c9b87a2f09cdee05c510c105b4a8d471b47402c38f4cdfa49fe6d", 16).toByteArray()); a_byte = new BigInteger(a, 16).toByteArray(); - params = new SRPParameters(new BigInteger(ConfigHelper.NG_1024, 16).toByteArray(), new BigInteger("2").toByteArray(), new BigInteger(salt, 16).toByteArray(), "SHA-256"); - client = new LeapSRPSession(username, password, params, a_byte); + client = new LeapSRPSession(username, password, a_byte); x = client.calculatePasswordHash(username, password, trim(new BigInteger(salt, 16).toByteArray())); assertTrue(Arrays.equals(x, expected_x)); @@ -541,8 +527,7 @@ public class testLeapSRPSession extends TestCase { expected_M2 = trim(new BigInteger("a382025452bad8a6ccd0f703253fda90e7ea7bd0c2d466a389455080a4bd015d", 16).toByteArray()); a_byte = new BigInteger(a, 16).toByteArray(); - params = new SRPParameters(new BigInteger(ConfigHelper.NG_1024, 16).toByteArray(), new BigInteger("2").toByteArray(), new BigInteger(salt, 16).toByteArray(), "SHA-256"); - client = new LeapSRPSession(username, password, params, a_byte); + client = new LeapSRPSession(username, password, a_byte); x = client.calculatePasswordHash(username, password, trim(new BigInteger(salt, 16).toByteArray())); assertTrue(Arrays.equals(x, expected_x)); @@ -572,8 +557,7 @@ public class testLeapSRPSession extends TestCase { expected_M2 = trim(new BigInteger("9e99f9adfbfaa7add3626ed6e6aea94c9fa60dab6b8d56ad0cc950548f577d32", 16).toByteArray()); a_byte = new BigInteger(a, 16).toByteArray(); - params = new SRPParameters(new BigInteger(ConfigHelper.NG_1024, 16).toByteArray(), new BigInteger("2").toByteArray(), new BigInteger(salt, 16).toByteArray(), "SHA-256"); - client = new LeapSRPSession(username, password, params, a_byte); + client = new LeapSRPSession(username, password, a_byte); x = client.calculatePasswordHash(username, password, trim(new BigInteger(salt, 16).toByteArray())); assertTrue(Arrays.equals(x, expected_x)); @@ -603,8 +587,7 @@ public class testLeapSRPSession extends TestCase { expected_M2 = trim(new BigInteger("ffccafa0febc1771a428082b30b7ce409856de4581c7d7d986f5b80015aba0d3", 16).toByteArray()); a_byte = new BigInteger(a, 16).toByteArray(); - params = new SRPParameters(new BigInteger(ConfigHelper.NG_1024, 16).toByteArray(), new BigInteger("2").toByteArray(), new BigInteger(salt, 16).toByteArray(), "SHA-256"); - client = new LeapSRPSession(username, password, params, a_byte); + client = new LeapSRPSession(username, password, a_byte); x = client.calculatePasswordHash(username, password, trim(new BigInteger(salt, 16).toByteArray())); assertTrue(Arrays.equals(x, expected_x)); @@ -626,8 +609,7 @@ public class testLeapSRPSession extends TestCase { String password = "holahola2"; byte[] salt = new BigInteger("67e8348d1500d26c", 16).toByteArray(); - SRPParameters params = new SRPParameters(new BigInteger(ConfigHelper.NG_1024, 16).toByteArray(), new BigInteger("2").toByteArray(), salt, "SHA-256"); - LeapSRPSession client = new LeapSRPSession(username, password, params); + LeapSRPSession client = new LeapSRPSession(username, password); String expected_v = "12bea84e588ffa2f8fc5ae47cb5e751a8f2d9e8125268ad9ab483eff83f98cb08484350eb478bee582b8b72363ff8e7b12e9f332e86f7a0bd77689927c609d275471c6ad2cff8b1e7bbfc3664169c3b7bccb0b974154c1f1656b64274568015ca1b849c9d9890ae4437ed686341b432340809b81c30727ed2aadea8bdec6d101"; |