Hey everyone! I am working on a KMP project, wher...
# ktor
o
Hey everyone! I am working on a KMP project, where a client needs to connect to a locally running server. To access the server, Authentication using TLS is required, client & key certificate are provided. The authenticity of the server is provided using a self-signed certificate. The app is distributed on enterprise-grade phones, so trusting the self-signed certificate is not an issue, neither is the deployment of the client & key certificates. However, I am struggling with the TLS authentication at the server using the client & key certificates - as far as I can see, Ktor does not provide a simple solution to pass these certificates to the http(s) client. How would you implement the authentication?
I have found an example online (https://github.com/sergiocasero/kmm_mtls_sample), where someone else implemented this auth step using pure native code. Before diving deeper into this approach - is there a simpler option available?
In essence, I am trying to implement this Python snippet, ...
import requests
requests.get(url=auth_server, verify=ca_cert, cert=(client_cert, client_key))
... but using Ktor.
A reddit user pointed me towards this feature requests/design/whatever, which is just sitting there since 2 years https://youtrack.jetbrains.com/issue/KTOR-4085/Multiplatform-Client-Server-SSLTLS-configuration It seems that I will have to just run some native code 😞
a
What platforms do you target?
o
iOS and Android
a
Unfortunately, you must implement the TLS authentication on both platforms.