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
ephemient
04/24/2022, 3:06 AM
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
yschimke
04/24/2022, 6:42 AM
That's nice, have you considered building off okhttp-tls instead or as well?
yschimke
04/24/2022, 6:43 AM
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.
yschimke
04/24/2022, 6:45 AM
Ahhh, never mind, I see you aren't loading them, you are selecting a different or multiple TrustManager.