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

Unified Diff: net/quic/crypto/channel_id_chromium.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
« no previous file with comments | « net/quic/crypto/channel_id_chromium.h ('k') | net/quic/test_tools/crypto_test_utils_nss.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/crypto/channel_id_chromium.cc
diff --git a/net/quic/crypto/channel_id_chromium.cc b/net/quic/crypto/channel_id_chromium.cc
index 53feed30630965741a8f0394c7adf4c7e3f647a0..9a54e88a6864d2a0ad10abed4ca7e40313e3e12b 100644
--- a/net/quic/crypto/channel_id_chromium.cc
+++ b/net/quic/crypto/channel_id_chromium.cc
@@ -17,8 +17,9 @@
namespace net {
ChannelIDKeyChromium::ChannelIDKeyChromium(
- crypto::ECPrivateKey* ec_private_key)
- : ec_private_key_(ec_private_key) {}
+ scoped_ptr<crypto::ECPrivateKey> ec_private_key)
+ : ec_private_key_(ec_private_key.Pass()) {
+}
ChannelIDKeyChromium::~ChannelIDKeyChromium() {}
@@ -87,8 +88,7 @@ class ChannelIDSourceChromium::Job {
ChannelIDService* const channel_id_service_;
- std::string channel_id_private_key_;
- std::string channel_id_cert_;
+ scoped_ptr<crypto::ECPrivateKey> channel_id_crypto_key_;
ChannelIDService::RequestHandle channel_id_request_handle_;
// |hostname| specifies the hostname for which we need a channel ID.
@@ -178,9 +178,7 @@ int ChannelIDSourceChromium::Job::DoGetChannelIDKey(int result) {
next_state_ = STATE_GET_CHANNEL_ID_KEY_COMPLETE;
return channel_id_service_->GetOrCreateChannelID(
- hostname_,
- &channel_id_private_key_,
- &channel_id_cert_,
+ hostname_, &channel_id_crypto_key_,
base::Bind(&ChannelIDSourceChromium::Job::OnIOComplete,
base::Unretained(this)),
&channel_id_request_handle_);
@@ -193,28 +191,13 @@ int ChannelIDSourceChromium::Job::DoGetChannelIDKeyComplete(int result) {
return result;
}
- std::vector<uint8> encrypted_private_key_info(
- channel_id_private_key_.size());
- memcpy(&encrypted_private_key_info[0], channel_id_private_key_.data(),
- channel_id_private_key_.size());
-
- base::StringPiece spki_piece;
- if (!asn1::ExtractSPKIFromDERCert(channel_id_cert_, &spki_piece)) {
- return ERR_UNEXPECTED;
- }
- std::vector<uint8> subject_public_key_info(spki_piece.size());
- memcpy(&subject_public_key_info[0], spki_piece.data(), spki_piece.size());
-
- crypto::ECPrivateKey* ec_private_key =
- crypto::ECPrivateKey::CreateFromEncryptedPrivateKeyInfo(
- ChannelIDService::kEPKIPassword, encrypted_private_key_info,
- subject_public_key_info);
- if (!ec_private_key) {
+ if (!channel_id_crypto_key_) {
// TODO(wtc): use the new error code ERR_CHANNEL_ID_IMPORT_FAILED to be
// added in https://codereview.chromium.org/338093012/.
return ERR_UNEXPECTED;
}
- channel_id_key_.reset(new ChannelIDKeyChromium(ec_private_key));
+ channel_id_key_.reset(
+ new ChannelIDKeyChromium(channel_id_crypto_key_.Pass()));
return result;
}
« no previous file with comments | « net/quic/crypto/channel_id_chromium.h ('k') | net/quic/test_tools/crypto_test_utils_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698