Hey all, what's the easiest/best way to add a .pem...
# ktor
d
Hey all, what's the easiest/best way to add a .pem certificate to the list of trusted certificates of the httpclient on KMP?
For the android side, I've tried creating a network security config and adding the certificate there, but that doesn't seem to change anything.
My exact problem is this:
<http://javax.net|javax.net>.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
There is something wrong with the certificates of this domain:
<http://sms.eursc.eu|sms.eursc.eu>
In the old flutter version of my app, I just downloaded the certificate from chrome and added it to the app like so:
Copy code
ByteData data = await PlatformAssetBundle().load('assets/ca/eursc-eu.pem'); SecurityContext.defaultContext.setTrustedCertificatesBytes(data.buffer.asUint8List());
But now I can't find a simple way to do this with ktor on iOS and Android.
Ok so on Android adding the certificate to the network security config worked, I was just adding the wrong/expired one
Now the question is, how to do a similar thing on iOS?
So on iOS the problem is a bit different. The root CA was only trusted since iOS 16, and I was testing on a lower iOS version. So both operating systems working now, case closed 🙂