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

Unified Diff: net/spdy/spdy_session.cc

Issue 9455006: Fix SpdySession::WriteCredentialFrame ECPrivateKey creation args. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: forgot add Created 8 years, 10 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: net/spdy/spdy_session.cc
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index bd4381d287e8257eb4347658cb4a97f8744aecb9..38274d3b71847cfee6f3623f2eb6a0017debafec 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -21,9 +21,11 @@
#include "crypto/ec_signature_creator.h"
#include "crypto/rsa_private_key.h"
#include "crypto/signature_creator.h"
+#include "net/base/asn1_util.h"
#include "net/base/connection_type_histograms.h"
#include "net/base/net_log.h"
#include "net/base/net_util.h"
+#include "net/base/origin_bound_cert_service.h"
#include "net/http/http_network_session.h"
#include "net/http/http_server_properties.h"
#include "net/socket/ssl_client_socket.h"
@@ -637,15 +639,13 @@ int SpdySession::WriteCredentialFrame(const std::string& origin,
break;
}
case CLIENT_CERT_ECDSA_SIGN: {
- // Convert the cert string into a vector<unit8>
- std::vector<uint8> cert_data;
- for (size_t i = 0; i < cert.length(); i++) {
- cert_data.push_back(cert[i]);
- }
+ base::StringPiece spki_piece;
+ asn1::ExtractSPKIFromDERCert(cert, &spki_piece);
+ std::vector<uint8> spki(spki_piece.data(),
+ spki_piece.data() + spki_piece.size());
scoped_ptr<crypto::ECPrivateKey> private_key(
- crypto::ECPrivateKey::CreateFromEncryptedPrivateKeyInfo("",
- key_data,
- cert_data));
+ crypto::ECPrivateKey::CreateFromEncryptedPrivateKeyInfo(
+ OriginBoundCertService::kEPKIPassword, key_data, spki));
scoped_ptr<crypto::ECSignatureCreator> creator(
crypto::ECSignatureCreator::Create(private_key.get()));
creator->Sign(secret, arraysize(secret), &proof);
« net/spdy/spdy_http_stream_unittest.cc ('K') | « net/spdy/spdy_http_stream_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698