Skip to content
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

bug: SSL server certificate not found on iOS #63

Open
jvondermarck opened this issue Sep 5, 2024 · 5 comments
Open

bug: SSL server certificate not found on iOS #63

jvondermarck opened this issue Sep 5, 2024 · 5 comments

Comments

@jvondermarck
Copy link

jvondermarck commented Sep 5, 2024

Hello, I know an issue about this problem (kotlin.Exception: Server certificate path not found) that has been closed one year ago but there is no documentation about where do we need to put the certificate in a KMP project. I tried to put the file in many folders but so far it is not working...

I did this :

tls = TLSClientSettings(
      serverCertificate = Res.getUri("files/ca-certificates.crt"),
),

The file ca-certificates.crt is in my commainMain/commonResources/files folder.

And on Android I don't need to set a certificate, so it does not make sense at all, and I don't even know if the certificate I have a good since I never used one before...

@davidepianca98
Copy link
Owner

Hello, different platforms may include difference CA certificates and that could be the reason why you are not needing it for Android. I suggest putting the file in resources, reading it to string using the platform specific way and passing the value of the file to TLSClientSettings like this: TLSClientSettings(serverCertificate = certificateContent).
Otherwise you could disable verification by using TLSClientSettings(checkServerCertificate = false) for testing.

@UAndreiRamescu
Copy link

UAndreiRamescu commented Oct 8, 2024

I have the same problem in a compose multiplatform application, i don't understand how to pass the certificate, can you update the documentation please ?

@davidepianca98
Copy link
Owner

@UAndreiRamescu Regarding Compose Multiplatform resources I found the following links:

Once the file has been read, you can just pass the string content to the TLSClientSettings object.

@MohammadRezaei92
Copy link

MohammadRezaei92 commented Dec 25, 2024

Witch file should I use? .crt or .pem? chain or fullchain?

@davidepianca98
Copy link
Owner

Only PEM files are accepted. Only the root certificated should be needed. But if not working you could try the full chain.

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

No branches or pull requests

4 participants