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

Unified Diff: android_webview/native/aw_contents_client_bridge.cc

Issue 1304143010: Plumbing SSLPrivateKey Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix rebase. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | android_webview/native/aw_contents_client_bridge_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/native/aw_contents_client_bridge.cc
diff --git a/android_webview/native/aw_contents_client_bridge.cc b/android_webview/native/aw_contents_client_bridge.cc
index 4d2fd4dcb7d10282a76af0b20863f8625f5b70f3..60aea5b347797025b7a7a76522c70b5039c8b7d0 100644
--- a/android_webview/native/aw_contents_client_bridge.cc
+++ b/android_webview/native/aw_contents_client_bridge.cc
@@ -20,9 +20,10 @@
#include "jni/AwContentsClientBridge_jni.h"
#include "net/android/keystore_openssl.h"
#include "net/cert/x509_certificate.h"
-#include "net/ssl/openssl_client_key_store.h"
#include "net/ssl/ssl_cert_request_info.h"
#include "net/ssl/ssl_client_cert_type.h"
+#include "net/ssl/ssl_platform_key.h"
+#include "net/ssl/ssl_private_key.h"
#include "url/gurl.h"
using base::android::AttachCurrentThread;
@@ -35,20 +36,6 @@ using content::BrowserThread;
namespace android_webview {
-namespace {
-
-// Must be called on the I/O thread to record a client certificate
-// and its private key in the OpenSSLClientKeyStore.
-void RecordClientCertificateKey(
- const scoped_refptr<net::X509Certificate>& client_cert,
- crypto::ScopedEVP_PKEY private_key) {
- DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
- net::OpenSSLClientKeyStore::GetInstance()->RecordClientCertPrivateKey(
- client_cert.get(), private_key.get());
-}
-
-} // namespace
-
AwContentsClientBridge::AwContentsClientBridge(JNIEnv* env, jobject obj)
: java_ref_(env, obj) {
DCHECK(obj);
@@ -210,7 +197,7 @@ void AwContentsClientBridge::ProvideClientCertificateResponse(
if (encoded_chain_ref.is_null() || private_key_ref.is_null()) {
LOG(ERROR) << "No client certificate selected";
pending_client_cert_request_delegates_.Remove(request_id);
- delegate->ContinueWithCertificate(nullptr);
+ delegate->ContinueWithCertificate(nullptr, nullptr);
delete delegate;
return;
}
@@ -248,6 +235,9 @@ void AwContentsClientBridge::ProvideClientCertificateResponse(
return;
}
+ scoped_refptr<net::SSLPrivateKey> client_private_key =
+ net::WrapOpenSSLPrivateKey(std::move(private_key));
+
// Release the guard and |pending_client_cert_request_delegates_| references
// to |delegate|.
pending_client_cert_request_delegates_.Remove(request_id);
@@ -256,12 +246,10 @@ void AwContentsClientBridge::ProvideClientCertificateResponse(
// RecordClientCertificateKey() must be called on the I/O thread,
// before the delegate is called with the selected certificate on
// the UI thread.
- content::BrowserThread::PostTaskAndReply(
+ content::BrowserThread::PostTask(
content::BrowserThread::IO, FROM_HERE,
- base::Bind(&RecordClientCertificateKey, client_cert,
- base::Passed(&private_key)),
base::Bind(&content::ClientCertificateDelegate::ContinueWithCertificate,
- base::Owned(delegate), client_cert));
+ base::Owned(delegate), client_cert, client_private_key));
}
void AwContentsClientBridge::RunJavaScriptDialog(
« no previous file with comments | « no previous file | android_webview/native/aw_contents_client_bridge_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698