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

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: Fixing upload and refptr. Created 5 years, 2 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') | content/test/BUILD.gn » ('J')
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 6890955aaabdd1246d6a9f9f31771faf6d8439c6..e5d323fe3c32e3c7d45240371198d9b6ff9c9149 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);
@@ -209,7 +196,7 @@ void AwContentsClientBridge::ProvideClientCertificateResponse(
if (encoded_chain_ref == NULL || private_key_ref == 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;
}
@@ -247,6 +234,9 @@ void AwContentsClientBridge::ProvideClientCertificateResponse(
return;
}
+ scoped_refptr<net::SSLPrivateKey> client_private_key =
+ net::WrapOpenSSLPrivateKey(private_key.Pass());
+
// Release the guard and |pending_client_cert_request_delegates_| references
// to |delegate|.
pending_client_cert_request_delegates_.Remove(request_id);
@@ -255,12 +245,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') | content/test/BUILD.gn » ('J')

Powered by Google App Engine
This is Rietveld 408576698