-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Use bouncy castle to generate certs for TLS. #10
Conversation
Because there are no platform APIs to generate certificates, this needs a third party library (bouncy castle) to do the heavy lifting. Each target platform has its own built-in crypto library: - The JVM has its own internal crypto library. It uses key stores like "JCA". - Android has its own internal crypto library that's based on bouncy castle. It is repackaged in com.android and is not used by this code. With this change, okhttp brings its own copy of bouncy castle for cert generation. Once the certificate is generated we're done with bouncy castle, and use the platform libraries for TLS. This approach allows us to use one codebase on either platform.
Use bouncy castle to generate certs for TLS.
RecordedRequest request = server.takeRequest(); | ||
assertEquals("GET /foo HTTP/1.1", request.getRequestLine()); | ||
} | ||
|
||
// public void testConnectViaHttpsReusingConnections() throws IOException, InterruptedException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this test coming in another pull?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, there's a bunch of 'em still to uncomment:
https://github.com/square/okhttp/blob/33a0c620e1c1997ece0ee3382ad3e2145ee061a8/src/test/java/libcore/net/http/URLConnectionTest.java
I commented out these tests when I split okhttp off from HttpURLConnection. Now that I have TLS, I can put them back.
Because there are no platform APIs to generate certificates,
this needs a third party library (bouncy castle) to do the
heavy lifting.
Each target platform has its own built-in crypto library:
key stores like "JCA".
based on bouncy castle. It is repackaged in com.android
and is not used by this code.
With this change, okhttp brings its own copy of bouncy castle
for cert generation. Once the certificate is generated we're
done with bouncy castle, and use the platform libraries for TLS.
This approach allows us to use one codebase on either platform.