OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/spdy/spdy_credential_builder.h" | 5 #include "net/spdy/spdy_credential_builder.h" |
6 | 6 |
7 #include "base/threading/sequenced_worker_pool.h" | 7 #include "base/threading/sequenced_worker_pool.h" |
8 #include "crypto/ec_signature_creator.h" | 8 #include "crypto/ec_signature_creator.h" |
9 #include "crypto/ec_private_key.h" | 9 #include "crypto/ec_private_key.h" |
10 #include "net/base/asn1_util.h" | 10 #include "net/base/asn1_util.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 int Build() { | 63 int Build() { |
64 return BuildWithType(CLIENT_CERT_ECDSA_SIGN); | 64 return BuildWithType(CLIENT_CERT_ECDSA_SIGN); |
65 } | 65 } |
66 | 66 |
67 std::string GetCredentialSecret() { | 67 std::string GetCredentialSecret() { |
68 return SpdyCredentialBuilder::GetCredentialSecret( | 68 return SpdyCredentialBuilder::GetCredentialSecret( |
69 MockClientSocket::kTlsUnique); | 69 MockClientSocket::kTlsUnique); |
70 } | 70 } |
71 | 71 |
72 SpdyTestStateHelper helper_; // Provides deterministic EC signatures. | |
73 std::string cert_; | 72 std::string cert_; |
74 std::string key_; | 73 std::string key_; |
75 SpdyCredential credential_; | 74 SpdyCredential credential_; |
| 75 MockECSignatureCreatorFactory ec_signature_creator_factory_; |
76 }; | 76 }; |
77 | 77 |
78 // http://crbug.com/142833, http://crbug.com/140991. The following tests fail | 78 // http://crbug.com/142833, http://crbug.com/140991. The following tests fail |
79 // with OpenSSL due to the unimplemented ec_private_key_openssl.cc. | 79 // with OpenSSL due to the unimplemented ec_private_key_openssl.cc. |
80 #if defined(USE_OPENSSL) | 80 #if defined(USE_OPENSSL) |
81 #define MAYBE_GetCredentialSecret DISABLED_GetCredentialSecret | 81 #define MAYBE_GetCredentialSecret DISABLED_GetCredentialSecret |
82 #else | 82 #else |
83 #define MAYBE_GetCredentialSecret GetCredentialSecret | 83 #define MAYBE_GetCredentialSecret GetCredentialSecret |
84 #endif | 84 #endif |
85 | 85 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 crypto::ECSignatureCreator::Create(private_key.get())); | 162 crypto::ECSignatureCreator::Create(private_key.get())); |
163 std::string secret = GetCredentialSecret(); | 163 std::string secret = GetCredentialSecret(); |
164 creator->Sign(reinterpret_cast<const unsigned char *>(secret.data()), | 164 creator->Sign(reinterpret_cast<const unsigned char *>(secret.data()), |
165 secret.length(), &proof_data); | 165 secret.length(), &proof_data); |
166 | 166 |
167 std::string proof(proof_data.begin(), proof_data.end()); | 167 std::string proof(proof_data.begin(), proof_data.end()); |
168 EXPECT_EQ(proof, credential_.proof); | 168 EXPECT_EQ(proof, credential_.proof); |
169 } | 169 } |
170 | 170 |
171 } // namespace net | 171 } // namespace net |
OLD | NEW |