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

Use bouncy castle to generate certs for TLS. #10

Merged
merged 1 commit into from Aug 1, 2012
Merged

Conversation

swankjesse
Copy link
Member

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.

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.
JakeWharton added a commit that referenced this pull request Aug 1, 2012
Use bouncy castle to generate certs for TLS.
@JakeWharton JakeWharton merged commit 54439c2 into master Aug 1, 2012
RecordedRequest request = server.takeRequest();
assertEquals("GET /foo HTTP/1.1", request.getRequestLine());
}

// public void testConnectViaHttpsReusingConnections() throws IOException, InterruptedException {
Copy link
Contributor

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?

Copy link
Member Author

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.

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

Successfully merging this pull request may close these issues.

None yet

3 participants