Code Monkey home page Code Monkey logo

cert4android's People

Contributors

arnyminerz avatar mbiebl avatar rfc2822 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cert4android's Issues

CustomCertService checkTrusted: use CompleteableDeferred instead of POJO lock/notify

To make the library more stable and future-proof, I'd like to get rid of some legacies like AIDL (#12) or in this case POJO lock/notify:

val callback = object: IOnCertificateDecision {
override fun accept() {
synchronized(lock) {
valid = true
lock.notify()
}
}
override fun reject() {
synchronized(lock) {
valid = false
lock.notify()
}
}
}
try {
svc.checkTrusted(cert.encoded, interactive, appInForeground, callback)
synchronized(lock) {
if (valid == null) {
Cert4Android.log.fine("Waiting for reply from service")
try {
lock.wait(SERVICE_TIMEOUT)
} catch(_: InterruptedException) {
}
}

I think a more modern approach would be:

I hope that this will work as I imagine. Can you please give it a try @ArnyminerZ?

Not building on Windows machines.

The way the module actually defines package names. As stated by Google in Android Developers, the package name should be stated in the build.gradle file. Updating the build.gradle file to add the namespace option fixes the problem:

android {
    defaultConfig {
        namespace "at.bitfire.cert4android"
    }
}

In any case, this change is recommended in AGP 7.3+. So it should be implemented.

Remove AIDL dependency

We don't need the AIDL interfaces; they are from times when cert4android had to communicate between multiple processes (because DAVx⁵ was split into multiple processes).

AIDL is disabled by default since AGP 8.0 and I think we should get rid of it.

It should be replaced by appropriate inter-thread communication.

Exception java.lang.IllegalStateException: Already resumed, but proposed with update false

I've copied this from the Google Play Console. Not occurring often but we should fix it ;-)

Exception java.lang.IllegalStateException: Already resumed, but proposed with update false
  at kotlinx.coroutines.CancellableContinuationImpl.alreadyResumedError (CancellableContinuationImpl.kt:559)
  at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl (CancellableContinuationImpl.kt:524)
  at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl$default (CancellableContinuationImpl.kt:497)
  at kotlinx.coroutines.CancellableContinuationImpl.resumeWith (CancellableContinuationImpl.kt:368)
  at at.bitfire.cert4android.UserDecisionRegistry.onUserDecision (UserDecisionRegistry.kt:113)
  at at.bitfire.cert4android.TrustCertificateActivity$Model.registerDecision (TrustCertificateActivity.kt:312)
  at at.bitfire.cert4android.TrustCertificateActivity$onCreate$2.handleOnBackPressed (TrustCertificateActivity.kt:77)
  at androidx.activity.OnBackPressedDispatcher.onBackPressed (OnBackPressedDispatcher.kt:213)
  at androidx.activity.ComponentActivity.onBackPressed (ComponentActivity.java:694)
  at android.app.Activity.onKeyUp (Activity.java:3940)
  at android.view.KeyEvent.dispatch (KeyEvent.java:3143)
  at android.app.Activity.dispatchKeyEvent (Activity.java:4286)
  at androidx.core.app.ComponentActivity.superDispatchKeyEvent (ComponentActivity.java:126)
  at androidx.core.view.KeyEventDispatcher.dispatchKeyEvent (KeyEventDispatcher.java:86)
  at androidx.core.app.ComponentActivity.dispatchKeyEvent (ComponentActivity.java:144)
  at com.android.internal.policy.DecorView.dispatchKeyEvent (DecorView.java:415)
  at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent (ViewRootImpl.java:6664)
  at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess (ViewRootImpl.java:6530)
  at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:5990)
  at android.view.ViewRootImpl$InputStage.onDeliverToNext (ViewRootImpl.java:6047)
  at android.view.ViewRootImpl$InputStage.forward (ViewRootImpl.java:6013)
  at android.view.ViewRootImpl$AsyncInputStage.forward (ViewRootImpl.java:6178)
  at android.view.ViewRootImpl$InputStage.apply (ViewRootImpl.java:6021)
  at android.view.ViewRootImpl$AsyncInputStage.apply (ViewRootImpl.java:6235)
  at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:5994)
  at android.view.ViewRootImpl$InputStage.onDeliverToNext (ViewRootImpl.java:6047)
  at android.view.ViewRootImpl$InputStage.forward (ViewRootImpl.java:6013)
  at android.view.ViewRootImpl$InputStage.apply (ViewRootImpl.java:6021)
  at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:5994)
  at android.view.ViewRootImpl$InputStage.onDeliverToNext (ViewRootImpl.java:6047)
  at android.view.ViewRootImpl$InputStage.forward (ViewRootImpl.java:6013)
  at android.view.ViewRootImpl$AsyncInputStage.forward (ViewRootImpl.java:6211)
  at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent (ViewRootImpl.java:6391)
  at android.view.inputmethod.InputMethodManager$PendingEvent.run (InputMethodManager.java:3667)
  at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback (InputMethodManager.java:3187)
  at android.view.inputmethod.InputMethodManager.finishedInputEvent (InputMethodManager.java:3178)
  at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished (InputMethodManager.java:3644)
  at android.view.InputEventSender.dispatchInputEventFinished (InputEventSender.java:154)
  at android.os.MessageQueue.nativePollOnce
  at android.os.MessageQueue.next (MessageQueue.java:335)
  at android.os.Looper.loopOnce (Looper.java:185)
  at android.os.Looper.loop (Looper.java:359)
  at android.app.ActivityThread.main (ActivityThread.java:8127)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:548)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:942)

Raise importance notification level

When a certificate becomes invalid over time, users sometimes don't see the certification notification, and then the connections are rejected with time out.

Let's try with one level higher notifications (importance high):

  • in NotificationUtils.createChannels
  • and I think we have to set it in the actual NotificationCompat.Builder too, for Android versions that don't have channels yet

When timeout occurs Activity is not closed

When the timeout ends for accepting a new certificate, if the TrustCertificateActivity is open, it's never finished, so the Activity just lays there. It should be closed automatically.

Migrate to Jetpack Compose

There's currently just TrustCertificateActivity in cert4android, so we can migrate it to Jetpack Compose, and see how it goes, before migrating icsx5 and the bigger projects.

Steps:

  • Disable dataBinding and enable compose
  • Configure Jetpack Compose
    • Configure app's build.gradle
    • Add dependencies
  • Add Accompanist Theme Adapter for testing automatic theme migration.
  • Migrate all the UI inside TrustCertificateActivity
  • Remove activity_trust_certificate from layouts.
  • Remove all the XML libraries from build.gradle

If CN is invalid with given domain or IP no connection is established (and also no prompt to continue explicitly)

People report that they are now unable to connect DAVx5 to their server in certain certificate use cases. It seems that our handling is correct, and in the past this was wrong. But maybe we can give them an option to accept the certificate anyway?

curl https://mail.elestra.si:2080/
curl: (60) SSL: no alternative certificate subject name matches target host name '[mail.elestra.si](http://mail.elestra.si/)'
More details here: https://curl.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above

Ticket references:

https://bitfire-at.zammad.com/#ticket/zoom/2632
https://bitfire-at.zammad.com/#ticket/zoom/2620

Make this a real library (instead of a submodule)

We would have to care less about compile-time settings when this would be a real library. It would be easier to integrate with other projects.

I think of this is a separate library that

  • can be added as a normal dependency and then be used in other projects

  • has two components, something like a lib and and sample-app directory:

    • lib contains the lib and is what is imported when other projects add the dependency
    • sample-app contains a minimum sample app that also allows to test cert4android in real when debugging (not imported with the dependency)
  • make it a jitpack library

  • document how to embed the library

  • separate demo app from lib

    • build action for jitpack should only build lib
    • demo app can be opened in Android Studio to test and work on the lib

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.