-
Notifications
You must be signed in to change notification settings - Fork 36
Improve support for self-signed certs, Let's Encrypt, and option to trust all SSL certs #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| implementation fileTree(include: ['*.jar'], dir: 'libs') | ||
| implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" | ||
| implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" | ||
| implementation 'com.android.support:appcompat-v7:27.0.2' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I... am not sure why I needed to change this. Probably Android Studio was complaining. It's probably not needed, right?
I did check and I think the project has somewhat-outdated gradle and SDK versions... but I don't know if this change will be good.
| import javax.net.ssl.TrustManager | ||
| import javax.net.ssl.X509TrustManager | ||
|
|
||
| class CustomTrustClient { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class looked much prettier in Java, I think. I don't know Kotlin, but I guessed you wouldn't want to mix languages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My original code: https://gist.github.com/jkurei/26eeba6cbdc3f4c16394d9cbe0d3acfd
| @Throws(Exception::class) | ||
| fun run() { | ||
| val request = Request.Builder() | ||
| .url("https://publicobject.com/helloworld.txt") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you pls explain what purpose has this call to this website?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely none, just test code. I'll remove it.
| customCertInput.visibility = View.GONE | ||
| } | ||
| } | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps I just can't see it, but is the cert setting saved somewhere? I can see that the login will be attempted with the chosen cert setting, but then when I close the app and want to use it to send some text note to trilium server, how will the app know which cert settings has been chosen before?
I was having a lot of issues getting trilium-sender to work for me... didn't work with a self-signed cert, and it didn't even work with a Let's Encrypt cert.
To fix it, and make it easier to use, I implemented the following solution:
I am not experienced with Android. I know my way around Javaa, so I coded this in Java and translated it into Kotlin using Android Studio, so it may or may not look like idiomatic Kotlin...
If you have any feedback to improve this, please let me know.