Loading build.gradle +2 −2 Original line number Diff line number Diff line Loading @@ -47,8 +47,8 @@ android { dependencies { compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" compile 'com.android.support:appcompat-v7:27.0.0' compile 'com.android.support:cardview-v7:27.0.0' compile 'com.android.support:appcompat-v7:27.0.1' compile 'com.android.support:cardview-v7:27.0.1' //noinspection GradleDynamicVersion androidTestCompile 'com.android.support.test:runner:+' Loading src/androidTest/java/at/bitfire/cert4android/CustomCertManagerTest.java +11 −12 Original line number Diff line number Diff line Loading @@ -46,11 +46,11 @@ public class CustomCertManagerTest { Messenger service; static X509Certificate[] siteCerts; private static X509Certificate[] siteCerts; static { try { siteCerts = getSiteCertificates(new URL("https://davdroid.bitfire.at")); } catch(IOException e) { siteCerts = getSiteCertificates(new URL("https://www.davdroid.com")); } catch(IOException ignored) { } assertNotNull(siteCerts); } Loading @@ -62,15 +62,14 @@ public class CustomCertManagerTest { // loop required because of https://code.google.com/p/android/issues/detail?id=180396 IBinder binder = bindService(CustomCertService.class); assertNotNull(binder); service = new Messenger(binder); certManager = new CustomCertManager(getContext(), true, service); CustomCertManager.resetCertificates(getContext()); certManager = new CustomCertManager(getContext(), false); assertNotNull(certManager); certManager.resetCertificates(getContext()); paranoidCertManager = new CustomCertManager(getContext(), false, service); paranoidCertManager = new CustomCertManager(getContext(), false, false); assertNotNull(paranoidCertManager); paranoidCertManager.resetCertificates(getContext()); } @After Loading Loading @@ -101,7 +100,7 @@ public class CustomCertManagerTest { paranoidCertManager.checkServerTrusted(siteCerts, "RSA"); } // fails randomly (in about 1 of 3 cases) for unknown reason: // fails randomly for unknown reason: @Test(expected = CertificateException.class) public void testRemoveCustomCertificate() throws CertificateException, TimeoutException, InterruptedException { addCustomCertificate(); Loading @@ -110,17 +109,17 @@ public class CustomCertManagerTest { // should now be rejected for the whole session, i.e. no timeout anymore Intent intent = new Intent(getContext(), CustomCertService.class); intent.setAction(CustomCertService.CMD_CERTIFICATION_DECISION); intent.putExtra(CustomCertService.EXTRA_CERTIFICATE, siteCerts[0]); intent.putExtra(CustomCertService.EXTRA_CERTIFICATE, siteCerts[0].getEncoded()); intent.putExtra(CustomCertService.EXTRA_TRUSTED, false); startService(intent, CustomCertService.class); paranoidCertManager.checkServerTrusted(siteCerts, "RSA"); } private void addCustomCertificate() throws TimeoutException, InterruptedException { private void addCustomCertificate() throws CertificateException, TimeoutException, InterruptedException { // add certificate and check again Intent intent = new Intent(getContext(), CustomCertService.class); intent.setAction(CustomCertService.CMD_CERTIFICATION_DECISION); intent.putExtra(CustomCertService.EXTRA_CERTIFICATE, siteCerts[0]); intent.putExtra(CustomCertService.EXTRA_CERTIFICATE, siteCerts[0].getEncoded()); intent.putExtra(CustomCertService.EXTRA_TRUSTED, true); startService(intent, CustomCertService.class); } Loading src/main/aidl/at/bitfire/cert4android/ICustomCertService.aidl 0 → 100644 +10 −0 Original line number Diff line number Diff line package at.bitfire.cert4android; import at.bitfire.cert4android.IOnCertificateDecision; interface ICustomCertService { void checkTrusted(in byte[] cert, boolean interactive, boolean foreground, IOnCertificateDecision callback); void abortCheck(IOnCertificateDecision callback); } src/main/aidl/at/bitfire/cert4android/IOnCertificateDecision.aidl 0 → 100644 +8 −0 Original line number Diff line number Diff line package at.bitfire.cert4android; interface IOnCertificateDecision { void accept(); void reject(); } src/main/java/at/bitfire/cert4android/Constants.kt +1 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ import java.util.logging.Logger object Constants { private val TAG = "cert4android" val TAG = "cert4android" @JvmField var log: Logger = Logger.getLogger(TAG) Loading Loading
build.gradle +2 −2 Original line number Diff line number Diff line Loading @@ -47,8 +47,8 @@ android { dependencies { compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" compile 'com.android.support:appcompat-v7:27.0.0' compile 'com.android.support:cardview-v7:27.0.0' compile 'com.android.support:appcompat-v7:27.0.1' compile 'com.android.support:cardview-v7:27.0.1' //noinspection GradleDynamicVersion androidTestCompile 'com.android.support.test:runner:+' Loading
src/androidTest/java/at/bitfire/cert4android/CustomCertManagerTest.java +11 −12 Original line number Diff line number Diff line Loading @@ -46,11 +46,11 @@ public class CustomCertManagerTest { Messenger service; static X509Certificate[] siteCerts; private static X509Certificate[] siteCerts; static { try { siteCerts = getSiteCertificates(new URL("https://davdroid.bitfire.at")); } catch(IOException e) { siteCerts = getSiteCertificates(new URL("https://www.davdroid.com")); } catch(IOException ignored) { } assertNotNull(siteCerts); } Loading @@ -62,15 +62,14 @@ public class CustomCertManagerTest { // loop required because of https://code.google.com/p/android/issues/detail?id=180396 IBinder binder = bindService(CustomCertService.class); assertNotNull(binder); service = new Messenger(binder); certManager = new CustomCertManager(getContext(), true, service); CustomCertManager.resetCertificates(getContext()); certManager = new CustomCertManager(getContext(), false); assertNotNull(certManager); certManager.resetCertificates(getContext()); paranoidCertManager = new CustomCertManager(getContext(), false, service); paranoidCertManager = new CustomCertManager(getContext(), false, false); assertNotNull(paranoidCertManager); paranoidCertManager.resetCertificates(getContext()); } @After Loading Loading @@ -101,7 +100,7 @@ public class CustomCertManagerTest { paranoidCertManager.checkServerTrusted(siteCerts, "RSA"); } // fails randomly (in about 1 of 3 cases) for unknown reason: // fails randomly for unknown reason: @Test(expected = CertificateException.class) public void testRemoveCustomCertificate() throws CertificateException, TimeoutException, InterruptedException { addCustomCertificate(); Loading @@ -110,17 +109,17 @@ public class CustomCertManagerTest { // should now be rejected for the whole session, i.e. no timeout anymore Intent intent = new Intent(getContext(), CustomCertService.class); intent.setAction(CustomCertService.CMD_CERTIFICATION_DECISION); intent.putExtra(CustomCertService.EXTRA_CERTIFICATE, siteCerts[0]); intent.putExtra(CustomCertService.EXTRA_CERTIFICATE, siteCerts[0].getEncoded()); intent.putExtra(CustomCertService.EXTRA_TRUSTED, false); startService(intent, CustomCertService.class); paranoidCertManager.checkServerTrusted(siteCerts, "RSA"); } private void addCustomCertificate() throws TimeoutException, InterruptedException { private void addCustomCertificate() throws CertificateException, TimeoutException, InterruptedException { // add certificate and check again Intent intent = new Intent(getContext(), CustomCertService.class); intent.setAction(CustomCertService.CMD_CERTIFICATION_DECISION); intent.putExtra(CustomCertService.EXTRA_CERTIFICATE, siteCerts[0]); intent.putExtra(CustomCertService.EXTRA_CERTIFICATE, siteCerts[0].getEncoded()); intent.putExtra(CustomCertService.EXTRA_TRUSTED, true); startService(intent, CustomCertService.class); } Loading
src/main/aidl/at/bitfire/cert4android/ICustomCertService.aidl 0 → 100644 +10 −0 Original line number Diff line number Diff line package at.bitfire.cert4android; import at.bitfire.cert4android.IOnCertificateDecision; interface ICustomCertService { void checkTrusted(in byte[] cert, boolean interactive, boolean foreground, IOnCertificateDecision callback); void abortCheck(IOnCertificateDecision callback); }
src/main/aidl/at/bitfire/cert4android/IOnCertificateDecision.aidl 0 → 100644 +8 −0 Original line number Diff line number Diff line package at.bitfire.cert4android; interface IOnCertificateDecision { void accept(); void reject(); }
src/main/java/at/bitfire/cert4android/Constants.kt +1 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ import java.util.logging.Logger object Constants { private val TAG = "cert4android" val TAG = "cert4android" @JvmField var log: Logger = Logger.getLogger(TAG) Loading