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

Unified Diff: chrome/browser/extensions/api/messaging/message_property_provider.cc

Issue 1076063002: Remove certificates from Channel ID (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Udpate KeysEqual to fail if preconditions fail Created 5 years, 7 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
Index: chrome/browser/extensions/api/messaging/message_property_provider.cc
diff --git a/chrome/browser/extensions/api/messaging/message_property_provider.cc b/chrome/browser/extensions/api/messaging/message_property_provider.cc
index a1eb7acf72bf6bcbf97e113387506380572cd5eb..1d6603b041dcc0b85bc4812cced0c1c3704b60f7 100644
--- a/chrome/browser/extensions/api/messaging/message_property_provider.cc
+++ b/chrome/browser/extensions/api/messaging/message_property_provider.cc
@@ -11,6 +11,7 @@
#include "base/values.h"
#include "chrome/browser/profiles/profile.h"
#include "content/public/browser/browser_thread.h"
+#include "crypto/ec_private_key.h"
#include "extensions/common/api/runtime.h"
#include "net/base/completion_callback.h"
#include "net/cert/asn1_util.h"
@@ -46,8 +47,7 @@ void MessagePropertyProvider::GetChannelID(Profile* profile,
// ChannelIDService::GetChannelID to the callback provided to
// MessagePropertyProvider::GetChannelID.
struct MessagePropertyProvider::GetChannelIDOutput {
- std::string domain_bound_private_key;
- std::string domain_bound_cert;
+ scoped_ptr<crypto::ECPrivateKey> channel_id_key;
net::ChannelIDService::RequestHandle request_handle;
};
@@ -67,12 +67,9 @@ void MessagePropertyProvider::GetChannelIDOnIOThread(
original_task_runner,
base::Owned(output),
reply);
- int status = channel_id_service->GetChannelID(
- host,
- &output->domain_bound_private_key,
- &output->domain_bound_cert,
- net_completion_callback,
- &output->request_handle);
+ int status = channel_id_service->GetChannelID(host, &output->channel_id_key,
+ net_completion_callback,
+ &output->request_handle);
if (status == net::ERR_IO_PENDING)
return;
GotChannelID(original_task_runner, output, reply, status);
@@ -89,11 +86,13 @@ void MessagePropertyProvider::GotChannelID(
original_task_runner->PostTask(FROM_HERE, no_tls_channel_id_closure);
return;
}
- base::StringPiece spki;
- if (!net::asn1::ExtractSPKIFromDERCert(output->domain_bound_cert, &spki)) {
+ std::vector<uint8> spki_vector;
+ if (!output->channel_id_key->ExportPublicKey(&spki_vector)) {
original_task_runner->PostTask(FROM_HERE, no_tls_channel_id_closure);
return;
}
+ base::StringPiece spki(reinterpret_cast<char*>(vector_as_array(&spki_vector)),
+ spki_vector.size());
base::DictionaryValue jwk_value;
if (!net::JwkSerializer::ConvertSpkiFromDerToJwk(spki, &jwk_value)) {
original_task_runner->PostTask(FROM_HERE, no_tls_channel_id_closure);
« no previous file with comments | « chrome/browser/chromeos/login/profile_auth_data_unittest.cc ('k') | chrome/browser/extensions/extension_messages_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698