Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Issue 11266008: Fix certificate and keychain installation on Android. (Closed)

Created:
8 years, 2 months ago by digit1
Modified:
8 years ago
CC:
chromium-reviews, joi+watch-content_chromium.org, darin-cc_chromium.org, cbentzel+watch_chromium.org, jam
Base URL:
http://git.chromium.org/chromium/src.git@master
Visibility:
Public.

Description

Fix certificate and keychain installation on Android. This patch is necessary to allow Chrome on Android to properly install CA certificates and PKCS#12 keychains. This feature is not supported on other platforms, but necessary on mobile. It does modify the content client API to deal with the new file types, i.e. the AddNewCertificate() method is renamed AddCryptoFile(), and its signature changed to receive the file data directly (along with a file type enum). It is now the reponsability of the browser / content embedder to perform certificate verification. More specifically: - Modify net/base/mime_util.h to provide two new functions: * IsSupportedCertificateMimeType(), which returns true iff a mime type corresponds to a supported crypto file (only "application/x-x509-user-cert" is supported, except on Android, which adds ".../x-x509-ca-cert" and ".../x-pkcs12"). * GetCertificateMimeTypeForMimeType() which translates a mime type string into an enum value that is also understood from Java (see below), describing the type of file. Note that "net/base/mime_util_certificate_list.h" is used to hold the list of certificate mime type constants, both for C++ and Java (i.e. it is used to auto-generate org.chromium.net.CertificateMimeType.java at build time, under out/$BUILDTYPE/gen/template/). - Rename X509UserCertResourceHandler to CertificateResourceHandler under content/browser/loader/ in order to deal with all certificate mime types. Modify buffered_resource_handler.cc appropriately. - Add net::android::StoreCertificate(), and the Java org.chromium.net.AndroidNetworkLibrary.storeCertificate() method to send the certificate data for installation through the system's CertInstaller activity. - Add chrome::SSLAddCertificate() to implement the platform-specific code that used to be in content::ContentBrowserClient::AddNewCertificate(). - Rename content::ContentBrowserClient::AddNewCertificate() to ::AddCertificate(), and change its signature to accept resource file bytes directly and a net::CertificateMimeType (was an X509Certificate pointer). This change shall not modify the behaviour of Chromium on other platforms. BUG=149306 TEST=Manual test with ChromiumTestShell, see internal b/6668254 for details. Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=172350

Patch Set 1 #

Total comments: 8

Patch Set 2 : #

Total comments: 24

Patch Set 3 : Implement Ryan's suggested improvements #

Total comments: 7

Patch Set 4 : move some code to chrome/browser/ssl/ #

Total comments: 13

Patch Set 5 : rename CertificateType to CertificateMimeType #

Total comments: 6

Patch Set 6 : Fix indentation and Java constants #

Patch Set 7 : Really fix indentation. #

Patch Set 8 : auto-generate Java constants + rebase #

Total comments: 2

Patch Set 9 : git cl try #

Patch Set 10 : remove obsolete constants #

Total comments: 1

Patch Set 11 : separate android and openssl CertDatabase implementations #

Unified diffs Side-by-side diffs Delta from patch set Stats (+378 lines, -328 lines) Patch
M chrome/browser/chrome_content_browser_client.h View 1 2 3 4 5 6 7 1 chunk +4 lines, -2 lines 0 comments Download
M chrome/browser/chrome_content_browser_client.cc View 1 2 3 4 5 6 7 8 9 10 3 chunks +8 lines, -5 lines 0 comments Download
A chrome/browser/ssl/ssl_add_certificate.h View 1 2 3 4 1 chunk +29 lines, -0 lines 0 comments Download
A chrome/browser/ssl/ssl_add_certificate.cc View 1 2 3 4 1 chunk +37 lines, -0 lines 0 comments Download
A chrome/browser/ssl/ssl_add_certificate_android.cc View 1 2 3 4 1 chunk +42 lines, -0 lines 0 comments Download
M chrome/chrome_browser.gypi View 1 2 3 4 5 6 7 8 9 10 3 chunks +4 lines, -0 lines 0 comments Download
M content/browser/loader/buffered_resource_handler.cc View 1 2 3 4 5 6 7 2 chunks +6 lines, -6 lines 0 comments Download
A + content/browser/loader/certificate_resource_handler.h View 1 2 3 4 5 6 7 3 chunks +17 lines, -15 lines 0 comments Download
A + content/browser/loader/certificate_resource_handler.cc View 1 2 3 4 5 6 7 6 chunks +40 lines, -35 lines 0 comments Download
D content/browser/loader/x509_user_cert_resource_handler.h View 1 2 3 4 5 6 7 1 chunk +0 lines, -95 lines 0 comments Download
D content/browser/loader/x509_user_cert_resource_handler.cc View 1 2 3 4 5 6 7 1 chunk +0 lines, -140 lines 0 comments Download
M content/content_browser.gypi View 1 2 3 4 5 6 7 2 chunks +2 lines, -2 lines 0 comments Download
M content/public/browser/content_browser_client.h View 1 2 3 4 5 6 7 2 chunks +9 lines, -6 lines 0 comments Download
A + net/android/java/CertificateMimeType.template View 1 2 3 4 5 6 7 1 chunk +4 lines, -3 lines 0 comments Download
M net/android/java/src/org/chromium/net/AndroidNetworkLibrary.java View 1 2 3 4 5 6 7 8 2 chunks +42 lines, -0 lines 0 comments Download
M net/android/network_library.h View 1 2 3 4 2 chunks +7 lines, -0 lines 0 comments Download
M net/android/network_library.cc View 1 2 3 4 1 chunk +16 lines, -0 lines 0 comments Download
A + net/base/cert_database_android.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +12 lines, -16 lines 0 comments Download
M net/base/cert_database_openssl.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +0 lines, -1 line 0 comments Download
M net/base/mime_util.h View 1 2 3 4 5 6 7 2 chunks +12 lines, -0 lines 0 comments Download
M net/base/mime_util.cc View 1 2 3 4 5 6 3 chunks +34 lines, -1 line 0 comments Download
A net/base/mime_util_certificate_type_list.h View 1 2 3 4 5 6 7 1 chunk +13 lines, -0 lines 0 comments Download
M net/base/mime_util_unittest.cc View 1 2 3 4 2 chunks +24 lines, -0 lines 0 comments Download
M net/net.gyp View 1 2 3 4 5 6 7 8 9 10 4 chunks +16 lines, -1 line 0 comments Download

Messages

Total messages: 26 (0 generated)
digit1
This is a rewrite of the patch that was found at https://chromiumcodereview.appspot.com/11031043/, except that: - ...
8 years, 2 months ago (2012-10-24 13:00:48 UTC) #1
Ryan Sleevi
NACK on the "CryptoFile" naming scheme (see below). I think Darin and/or John Abd-El-Malek's feedback ...
8 years, 2 months ago (2012-10-24 22:01:25 UTC) #2
digit1
https://codereview.chromium.org/11266008/diff/1/content/browser/renderer_host/crypto_file_resource_handler.cc File content/browser/renderer_host/crypto_file_resource_handler.cc (right): https://codereview.chromium.org/11266008/diff/1/content/browser/renderer_host/crypto_file_resource_handler.cc#newcode113 content/browser/renderer_host/crypto_file_resource_handler.cc:113: // Note that it's up to the browser to ...
8 years, 1 month ago (2012-10-25 13:57:38 UTC) #3
darin (slow to review)
renaming to CertificateResourceHandler is fine, but see my note. i don't think any of this ...
8 years, 1 month ago (2012-10-26 07:34:05 UTC) #4
digit1
https://codereview.chromium.org/11266008/diff/4001/content/browser/renderer_host/buffered_resource_handler.cc File content/browser/renderer_host/buffered_resource_handler.cc (right): https://codereview.chromium.org/11266008/diff/4001/content/browser/renderer_host/buffered_resource_handler.cc#newcode306 content/browser/renderer_host/buffered_resource_handler.cc:306: if (net::IsSupportedCertificateMimeType(mime_type)) { In his original comment at https://codereview.chromium.org/11031043/, ...
8 years, 1 month ago (2012-10-26 11:38:10 UTC) #5
darin (slow to review)
On Fri, Oct 26, 2012 at 4:38 AM, <digit@chromium.org> wrote: > > https://codereview.chromium.**org/11266008/diff/4001/** > content/browser/renderer_host/**buffered_resource_handler.cc<https://codereview.chromium.org/11266008/diff/4001/content/browser/renderer_host/buffered_resource_handler.cc> ...
8 years, 1 month ago (2012-10-26 17:37:02 UTC) #6
Ryan Sleevi
https://codereview.chromium.org/11266008/diff/4001/chrome/browser/chrome_content_browser_client.cc File chrome/browser/chrome_content_browser_client.cc (right): https://codereview.chromium.org/11266008/diff/4001/chrome/browser/chrome_content_browser_client.cc#newcode1286 chrome/browser/chrome_content_browser_client.cc:1286: #ifdef OS_ANDROID nit: #if defined(OS_ANDROID) https://codereview.chromium.org/11266008/diff/4001/chrome/browser/chrome_content_browser_client.cc#newcode1299 chrome/browser/chrome_content_browser_client.cc:1299: // - ...
8 years, 1 month ago (2012-11-13 19:37:50 UTC) #7
digit1
https://chromiumcodereview.appspot.com/11266008/diff/4001/chrome/browser/chrome_content_browser_client.cc File chrome/browser/chrome_content_browser_client.cc (right): https://chromiumcodereview.appspot.com/11266008/diff/4001/chrome/browser/chrome_content_browser_client.cc#newcode1286 chrome/browser/chrome_content_browser_client.cc:1286: #ifdef OS_ANDROID On 2012/11/13 19:37:50, Ryan Sleevi wrote: > ...
8 years, 1 month ago (2012-11-15 17:42:13 UTC) #8
Ryan Sleevi
LGTM, mod a few nits. No need for re-review. If Darin is happy with this ...
8 years, 1 month ago (2012-11-15 20:05:59 UTC) #9
darin (slow to review)
https://chromiumcodereview.appspot.com/11266008/diff/17001/chrome/browser/chrome_content_browser_client.cc File chrome/browser/chrome_content_browser_client.cc (right): https://chromiumcodereview.appspot.com/11266008/diff/17001/chrome/browser/chrome_content_browser_client.cc#newcode1333 chrome/browser/chrome_content_browser_client.cc:1333: void ChromeContentBrowserClient::AddCertificates( nit: It seems like it would be ...
8 years, 1 month ago (2012-11-15 20:47:04 UTC) #10
digit1
Thanks Darin, the latest patch fixes the issues you noticed and moved some code to ...
8 years, 1 month ago (2012-11-21 09:33:13 UTC) #11
darin (slow to review)
https://chromiumcodereview.appspot.com/11266008/diff/23002/chrome/browser/ssl/ssl_add_certificate.cc File chrome/browser/ssl/ssl_add_certificate.cc (right): https://chromiumcodereview.appspot.com/11266008/diff/23002/chrome/browser/ssl/ssl_add_certificate.cc#newcode10 chrome/browser/ssl/ssl_add_certificate.cc:10: void chrome::SSLAddCertificate( nit: use "namespace chrome {" instead. https://chromiumcodereview.appspot.com/11266008/diff/23002/chrome/browser/ssl/ssl_add_certificate.cc#newcode20 ...
8 years ago (2012-11-26 19:53:42 UTC) #12
digit1
https://chromiumcodereview.appspot.com/11266008/diff/23002/chrome/browser/ssl/ssl_add_certificate.cc File chrome/browser/ssl/ssl_add_certificate.cc (right): https://chromiumcodereview.appspot.com/11266008/diff/23002/chrome/browser/ssl/ssl_add_certificate.cc#newcode10 chrome/browser/ssl/ssl_add_certificate.cc:10: void chrome::SSLAddCertificate( On 2012/11/26 19:53:43, darin wrote: > nit: ...
8 years ago (2012-11-26 21:41:34 UTC) #13
darin (slow to review)
https://chromiumcodereview.appspot.com/11266008/diff/28003/net/base/mime_util.cc File net/base/mime_util.cc (right): https://chromiumcodereview.appspot.com/11266008/diff/28003/net/base/mime_util.cc#newcode355 net/base/mime_util.cc:355: { "application/x-x509-user-cert", nit: indentation is wrong https://chromiumcodereview.appspot.com/11266008/diff/28003/net/base/mime_util.h File net/base/mime_util.h ...
8 years ago (2012-11-27 05:24:34 UTC) #14
digit1
https://chromiumcodereview.appspot.com/11266008/diff/28003/net/base/mime_util.cc File net/base/mime_util.cc (right): https://chromiumcodereview.appspot.com/11266008/diff/28003/net/base/mime_util.cc#newcode355 net/base/mime_util.cc:355: { "application/x-x509-user-cert", I treated this a a line-continuation indent. ...
8 years ago (2012-11-27 10:19:47 UTC) #15
digit1
fwiw, I've uploaded https://chromiumcodereview.appspot.com/11415152/ which addresses the Java template issue. I'll update this patch to ...
8 years ago (2012-11-27 16:52:33 UTC) #16
darin (slow to review)
https://chromiumcodereview.appspot.com/11266008/diff/28003/net/base/mime_util.cc File net/base/mime_util.cc (right): https://chromiumcodereview.appspot.com/11266008/diff/28003/net/base/mime_util.cc#newcode355 net/base/mime_util.cc:355: { "application/x-x509-user-cert", On 2012/11/27 10:19:48, digit1 wrote: > I ...
8 years ago (2012-11-27 21:27:53 UTC) #17
digit1
https://chromiumcodereview.appspot.com/11266008/diff/28003/net/base/mime_util.cc File net/base/mime_util.cc (right): https://chromiumcodereview.appspot.com/11266008/diff/28003/net/base/mime_util.cc#newcode355 net/base/mime_util.cc:355: { "application/x-x509-user-cert", Oh snap. Of course, I wasn't looking ...
8 years ago (2012-11-27 22:33:04 UTC) #18
digit1
Finally I could upload a new version of this patch. Note that the Java constants ...
8 years ago (2012-12-10 20:43:52 UTC) #19
digit1
https://chromiumcodereview.appspot.com/11266008/diff/32001/net/android/java/src/org/chromium/net/AndroidNetworkLibrary.java File net/android/java/src/org/chromium/net/AndroidNetworkLibrary.java (right): https://chromiumcodereview.appspot.com/11266008/diff/32001/net/android/java/src/org/chromium/net/AndroidNetworkLibrary.java#newcode35 net/android/java/src/org/chromium/net/AndroidNetworkLibrary.java:35: private static final int CERTIFICATE_MIME_TYPE_UNKNOWN = 0; these values ...
8 years ago (2012-12-10 21:10:30 UTC) #20
digit1
https://chromiumcodereview.appspot.com/11266008/diff/32001/net/android/java/src/org/chromium/net/AndroidNetworkLibrary.java File net/android/java/src/org/chromium/net/AndroidNetworkLibrary.java (right): https://chromiumcodereview.appspot.com/11266008/diff/32001/net/android/java/src/org/chromium/net/AndroidNetworkLibrary.java#newcode35 net/android/java/src/org/chromium/net/AndroidNetworkLibrary.java:35: private static final int CERTIFICATE_MIME_TYPE_UNKNOWN = 0; On 2012/12/10 ...
8 years ago (2012-12-10 21:52:05 UTC) #21
darin (slow to review)
LGTM https://chromiumcodereview.appspot.com/11266008/diff/42001/net/base/cert_database_openssl.cc File net/base/cert_database_openssl.cc (right): https://chromiumcodereview.appspot.com/11266008/diff/42001/net/base/cert_database_openssl.cc#newcode25 net/base/cert_database_openssl.cc:25: #if defined(OS_ANDROID) nit: Would it make more sense ...
8 years ago (2012-12-11 00:00:08 UTC) #22
digit1
On 2012/12/11 00:00:08, darin wrote: https://chromiumcodereview.appspot.com/11266008/diff/42001/net/base/cert_database_openssl.cc#newcode25 > net/base/cert_database_openssl.cc:25: #if defined(OS_ANDROID) > nit: Would it make ...
8 years ago (2012-12-11 13:34:59 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/digit@chromium.org/11266008/46001
8 years ago (2012-12-11 16:17:33 UTC) #24
darin (slow to review)
On 2012/12/11 13:34:59, digit1 wrote: > On 2012/12/11 00:00:08, darin wrote: > https://chromiumcodereview.appspot.com/11266008/diff/42001/net/base/cert_database_openssl.cc#newcode25 > > ...
8 years ago (2012-12-11 17:13:09 UTC) #25
commit-bot: I haz the power
8 years ago (2012-12-11 18:23:00 UTC) #26
Message was sent while issue was closed.
Change committed as 172350

Powered by Google App Engine
This is Rietveld 408576698