diff options
author | digit@chromium.org <digit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-11 20:13:45 +0000 |
---|---|---|
committer | digit@chromium.org <digit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-11 20:13:45 +0000 |
commit | 03a07b2ea1a0cb314a7ef409d142cd0f668b2254 (patch) | |
tree | 87af038f051e44830d200d5ca7464b67ad3ea3b1 /crypto | |
parent | a298f6e45114bdee170ed807033ba9fb5e00f35a (diff) | |
download | chromium_src-03a07b2ea1a0cb314a7ef409d142cd0f668b2254.zip chromium_src-03a07b2ea1a0cb314a7ef409d142cd0f668b2254.tar.gz chromium_src-03a07b2ea1a0cb314a7ef409d142cd0f668b2254.tar.bz2 |
This patch adds some Android-support code to allow the network
stack to use platform-specific private key objects to perform
signing in the context of SSL handshakes which require a client
certificate.
More specifically:
- Add net/android/keystore.h, which provides native
functions to operate on JNI references pointing to
java.security.PrivateKey objects provided by the
platform. I.e.:
net::android::GetPrivateKeyType()
net::android::SignWithPrivateKey()
Also provide a function that can get the system's own
EVP_PKEY* handle corresponding to a given PrivateKey
object. This uses reflection and should *only* be used
for RSA private keys when running on Android 4.0 and
4.1, in order to route around a platform bug that was
only fixed in 4.2.
net::android::GetOpenSSLSytstemHandleForPrivateKey()
See the comments in this source file for mode details:
net/android/java/org/chromium/net/AndroidKeyStore.java
- Add net/android/keystore_openssl.h, which provides
a function that can wrap an existing PrivateKey
JNI reference around an OpenSSL EVP_PKEY object
which uses custom DSA/RSA/ECDSA methods to perform
signing as expected to handle client certificates.
net::android::GetOpenSSLPrivateKeyWrapper()
- Add relevant unit tests for the new functions.
Note that the unit test comes with its own Java helper
function, which is used to create a platform PrivateKey
object from encoded PKCS#8 private key data.
This is called from the native unit test, but does not
constitute a new Java test (AndroidKeyStoreTestUtil.java).
- Add corresponding new test key files under
net/data/ssl/certificates/, and their generation
script in net/data/ssl/scripts/.
- Add net/android/private_key_type_list.h which is
used both from C++ and Java to define the list of
supported private key types used by this code.
- Minor improvements: Add a "release()" method to
crypto::ScopedOpenSSL, add missing BASE_EXPORT
to one base/android/jni_array.h function declaration.
BUG=166642
Review URL: https://chromiumcodereview.appspot.com/11571059
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@181741 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/openssl_util.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/crypto/openssl_util.h b/crypto/openssl_util.h index b390fe7..e8483c96 100644 --- a/crypto/openssl_util.h +++ b/crypto/openssl_util.h @@ -11,7 +11,7 @@ namespace crypto { -// A helper class that takes care of destroying OpenSSL objects when it goes out +// A helper class that takes care of destroying OpenSSL objects when they go out // of scope. template <typename T, void (*destructor)(T*)> class ScopedOpenSSL { @@ -23,6 +23,11 @@ class ScopedOpenSSL { } T* get() const { return ptr_; } + T* release() { + T* ptr = ptr_; + ptr_ = NULL; + return ptr; + } void reset(T* ptr) { if (ptr != ptr_) { if (ptr_) (*destructor)(ptr_); |