diff options
author | digit@chromium.org <digit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-11 18:22:58 +0000 |
---|---|---|
committer | digit@chromium.org <digit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-11 18:22:58 +0000 |
commit | 3b45550dbaca21fc86d6fa79f1e061d6e8090f85 (patch) | |
tree | 0b0a4ca0a8526ecdb04f288158f88e7e9744de60 /net/android/network_library.h | |
parent | 0f613db3a659bba8cc7b4b9f1df228cc9fb2fdea (diff) | |
download | chromium_src-3b45550dbaca21fc86d6fa79f1e061d6e8090f85.zip chromium_src-3b45550dbaca21fc86d6fa79f1e061d6e8090f85.tar.gz chromium_src-3b45550dbaca21fc86d6fa79f1e061d6e8090f85.tar.bz2 |
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.
Review URL: https://chromiumcodereview.appspot.com/11266008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@172350 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/android/network_library.h')
-rw-r--r-- | net/android/network_library.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/net/android/network_library.h b/net/android/network_library.h index c505202..955603d 100644 --- a/net/android/network_library.h +++ b/net/android/network_library.h @@ -11,6 +11,7 @@ #include <vector> #include "base/basictypes.h" +#include "net/base/mime_util.h" #include "net/base/net_export.h" namespace net { @@ -47,6 +48,12 @@ bool StoreKeyPair(const uint8* public_key, const uint8* private_key, size_t private_len); +// Helper used to pass the DER-encoded bytes of an X.509 certificate or +// a PKCS#12 archive holding a private key to the CertInstaller activity. +void StoreCertificate(net::CertificateMimeType cert_type, + const void* data, + size_t data_len); + // Returns true if it can determine that only loopback addresses are configured. // i.e. if only 127.0.0.1 and ::1 are routable. // Also returns false if it cannot determine this. |