I’ve just published <https://github.com/charleskor...
# squarelibraries
c
I’ve just published https://github.com/charleskorn/okhttp-system-keystore/, a small library that makes it easy to use trusted certificates from the operating system keystore (Keychain on macOS, Certificate Store on Windows) with OkHttp. Feedback, suggestions and ideas welcome 🙂
mind blown 1
👌 2
e
since it appears to use the SunMSCAPI anmd Apple providers, note that it won't work on versions of the JetBrains runtime released before February 2022: https://youtrack.jetbrains.com/issue/JBR-3917
👍 1
y
That's nice, have you considered building off okhttp-tls instead or as well?
It already has a small API for configuring the trust store.
Copy code
HandshakeCertificates clientCertificates = new HandshakeCertificates.Builder()
    .addPlatformTrustedCertificates()
    .build();
OkHttpClient client = new OkHttpClient.Builder()
    .sslSocketFactory(clientCertificates.sslSocketFactory(), clientCertificates.trustManager())
    .build();
Here platform, just means the standard JVM ones.
Ahhh, never mind, I see you aren't loading them, you are selecting a different or multiple TrustManager.
👍 1