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

Unified Diff: chrome/browser/extensions/extension_messages_apitest.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/extension_messages_apitest.cc
diff --git a/chrome/browser/extensions/extension_messages_apitest.cc b/chrome/browser/extensions/extension_messages_apitest.cc
index 9edda300b03e7b5ed5db2ea72b1b023c3c1ee341..39c872652b5c8920b013fd8aa9f809654340a90d 100644
--- a/chrome/browser/extensions/extension_messages_apitest.cc
+++ b/chrome/browser/extensions/extension_messages_apitest.cc
@@ -973,24 +973,21 @@ class ExternallyConnectableMessagingWithTlsChannelIdTest :
std::string CreateTlsChannelId() {
scoped_refptr<net::URLRequestContextGetter> request_context_getter(
profile()->GetRequestContext());
- std::string channel_id_private_key;
- std::string channel_id_cert;
- net::ChannelIDService::RequestHandle request_handle;
+ scoped_ptr<crypto::ECPrivateKey> channel_id_key;
+ net::ChannelIDService::RequestHandle request_handle;
content::BrowserThread::PostTask(
- content::BrowserThread::IO,
- FROM_HERE,
- base::Bind(
- &ExternallyConnectableMessagingWithTlsChannelIdTest::
- CreateDomainBoundCertOnIOThread,
- base::Unretained(this),
- base::Unretained(&channel_id_private_key),
- base::Unretained(&channel_id_cert),
- base::Unretained(&request_handle),
- request_context_getter));
+ content::BrowserThread::IO, FROM_HERE,
+ base::Bind(&ExternallyConnectableMessagingWithTlsChannelIdTest::
+ CreateDomainBoundCertOnIOThread,
+ base::Unretained(this), base::Unretained(&channel_id_key),
+ base::Unretained(&request_handle), request_context_getter));
tls_channel_id_created_.Wait();
// Create the expected value.
- base::StringPiece spki;
- net::asn1::ExtractSPKIFromDERCert(channel_id_cert, &spki);
+ std::vector<uint8> spki_vector;
+ if (!channel_id_key->ExportPublicKey(&spki_vector))
+ return std::string();
+ base::StringPiece spki(reinterpret_cast<char*>(
+ vector_as_array(&spki_vector)), spki_vector.size());
base::DictionaryValue jwk_value;
net::JwkSerializer::ConvertSpkiFromDerToJwk(spki, &jwk_value);
std::string tls_channel_id_value;
@@ -1000,8 +997,7 @@ class ExternallyConnectableMessagingWithTlsChannelIdTest :
private:
void CreateDomainBoundCertOnIOThread(
- std::string* channel_id_private_key,
- std::string* channel_id_cert,
+ scoped_ptr<crypto::ECPrivateKey>* channel_id_key,
net::ChannelIDService::RequestHandle* request_handle,
scoped_refptr<net::URLRequestContextGetter> request_context_getter) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
@@ -1009,11 +1005,9 @@ class ExternallyConnectableMessagingWithTlsChannelIdTest :
request_context_getter->GetURLRequestContext()->
channel_id_service();
int status = channel_id_service->GetOrCreateChannelID(
- chromium_org_url().host(),
- channel_id_private_key,
- channel_id_cert,
+ chromium_org_url().host(), channel_id_key,
base::Bind(&ExternallyConnectableMessagingWithTlsChannelIdTest::
- GotDomainBoundCert,
+ GotDomainBoundCert,
base::Unretained(this)),
request_handle);
if (status == net::ERR_IO_PENDING)

Powered by Google App Engine
This is Rietveld 408576698