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/base/server_bound_cert_service.h" | 5 #include "net/base/server_bound_cert_service.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 // Check that we can retrieve the key from the bytes. | 311 // Check that we can retrieve the key from the bytes. |
312 std::vector<uint8> key_vec(private_key_info.begin(), private_key_info.end()); | 312 std::vector<uint8> key_vec(private_key_info.begin(), private_key_info.end()); |
313 scoped_ptr<crypto::ECPrivateKey> private_key( | 313 scoped_ptr<crypto::ECPrivateKey> private_key( |
314 crypto::ECPrivateKey::CreateFromEncryptedPrivateKeyInfo( | 314 crypto::ECPrivateKey::CreateFromEncryptedPrivateKeyInfo( |
315 ServerBoundCertService::kEPKIPassword, key_vec, spki)); | 315 ServerBoundCertService::kEPKIPassword, key_vec, spki)); |
316 EXPECT_TRUE(private_key != NULL); | 316 EXPECT_TRUE(private_key != NULL); |
317 | 317 |
318 // Check that we can retrieve the cert from the bytes. | 318 // Check that we can retrieve the cert from the bytes. |
319 scoped_refptr<X509Certificate> x509cert( | 319 scoped_refptr<X509Certificate> x509cert( |
320 X509Certificate::CreateFromBytes(der_cert.data(), der_cert.size())); | 320 X509Certificate::CreateFromBytes(der_cert.data(), der_cert.size())); |
321 EXPECT_TRUE(x509cert != NULL); | 321 EXPECT_TRUE(x509cert.get() != NULL); |
322 } | 322 } |
323 | 323 |
324 // Tests that the callback of a canceled request is never made. | 324 // Tests that the callback of a canceled request is never made. |
325 TEST_F(ServerBoundCertServiceTest, CancelRequest) { | 325 TEST_F(ServerBoundCertServiceTest, CancelRequest) { |
326 std::string origin("https://encrypted.google.com:443"); | 326 std::string origin("https://encrypted.google.com:443"); |
327 SSLClientCertType type; | 327 SSLClientCertType type; |
328 std::string private_key_info, der_cert; | 328 std::string private_key_info, der_cert; |
329 int error; | 329 int error; |
330 std::vector<uint8> types; | 330 std::vector<uint8> types; |
331 types.push_back(CLIENT_CERT_ECDSA_SIGN); | 331 types.push_back(CLIENT_CERT_ECDSA_SIGN); |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 EXPECT_EQ(CLIENT_CERT_ECDSA_SIGN, type2); | 518 EXPECT_EQ(CLIENT_CERT_ECDSA_SIGN, type2); |
519 EXPECT_LT(1U, private_key_info2.size()); | 519 EXPECT_LT(1U, private_key_info2.size()); |
520 EXPECT_LT(1U, der_cert2.size()); | 520 EXPECT_LT(1U, der_cert2.size()); |
521 } | 521 } |
522 | 522 |
523 #endif // !defined(USE_OPENSSL) | 523 #endif // !defined(USE_OPENSSL) |
524 | 524 |
525 } // namespace | 525 } // namespace |
526 | 526 |
527 } // namespace net | 527 } // namespace net |
OLD | NEW |