Skip to content

Conversation

@Jnewbon
Copy link
Contributor

@Jnewbon Jnewbon commented Sep 23, 2025

Brief summary

Implementation of Mutual TLS support on the Android platform

Which issue is fixed?

Resolves #1419
Resolves #353

Pull Request Type

Affects Android, Both front and back end

In-depth Description

My plans as it stands is,

  • Build UI Client cert selector for each server
    • Select a cert per server
    • Edit a cert for existing servers
  • Update Kotlin API to make use of the selected cert
    • Separate the client builder and encapsulate mTLS usage
    • Redirect API calls into this new builder
    • Add plugin to accept request form frontend and route them through the new builder
    • Tested that this actually works
  • Update the VUE components to make use of the cert
    • Isolate all http calls into a central class
    • Add logic to detect if call can be redirected into the backend
    • Add ability to execute calls should backend not exist

1. UI Selection

That was a bit of a failed investigation, the SSL handshake in mTLS pipeline should allow for the server contacted to request the client (App) to send its user cert prompting the app to pop up a dialog listing installed certificate to choose from during the connection process. This would be an ideal situation as no extra UI would be needed, if the server needs a cert the user is prompted for on automatically

Sadly documentation for mTLS heavily favours hard-coded cert and keys where the app developer provide their own server and only want verified apps to be able to communicate with their server. i have been unable to find a way of getting the process to be automated thus have fallen to the backup of getting the user to manually select a cert when setting up the server connection.

ScreenShot Image Image Image

2. Kotlin API

Updating the Kotlin code to use mTLS based on a pre-selected certificate is well documented, so implementing this wasn't overly difficult, the main issue is ensuring that all calls in the Kotlin code based is routed via a client that has the mTLS certificate set. While this code is mostly done i haven't been able to test it properly due to the next section.

3. VUE API

The app is split in two, Kotlin and vue, both have their own client that independently send requests to the server, after doing some research into the possibility of keeping this split and support the ability of the vue client to use mTLS certificates; it inst builtin to the client currently in use (CapacitorHTTP), although there is a plugin that can add this support, it seems its not easy to add this into the app.

So the solution i am working towards is redirecting the requests into the kotlin code via the use of a custom capacitor plugin. this will allow the vue code to detect the presence of the plugin and thus the ability to reroute request via the Kotlin. for IOS this plugin wont exists and the vue will fallback to existing clients without mTLS support.

Comment and suggestion are welcome, I'm not a native app developer, so I'm bundling through this a lot with trial and error.

How have you tested this?

TBD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement]: Add mTLS support Support SSL client certificates

1 participant