| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/extras/sqlite/sqlite_channel_id_store.h" | 5 #include "net/extras/sqlite/sqlite_channel_id_store.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 base::FilePath cert_path = | 58 base::FilePath cert_path = |
| 59 GetTestCertsDirectory().AppendASCII("unittest.originbound.der"); | 59 GetTestCertsDirectory().AppendASCII("unittest.originbound.der"); |
| 60 ASSERT_TRUE(base::ReadFileToString(key_path, key_data)); | 60 ASSERT_TRUE(base::ReadFileToString(key_path, key_data)); |
| 61 ASSERT_TRUE(base::ReadFileToString(cert_path, cert_data)); | 61 ASSERT_TRUE(base::ReadFileToString(cert_path, cert_data)); |
| 62 std::vector<uint8_t> private_key(key_data->size()); | 62 std::vector<uint8_t> private_key(key_data->size()); |
| 63 memcpy(private_key.data(), key_data->data(), key_data->size()); | 63 memcpy(private_key.data(), key_data->data(), key_data->size()); |
| 64 base::StringPiece spki; | 64 base::StringPiece spki; |
| 65 ASSERT_TRUE(asn1::ExtractSPKIFromDERCert(*cert_data, &spki)); | 65 ASSERT_TRUE(asn1::ExtractSPKIFromDERCert(*cert_data, &spki)); |
| 66 std::vector<uint8_t> public_key(spki.size()); | 66 std::vector<uint8_t> public_key(spki.size()); |
| 67 memcpy(public_key.data(), spki.data(), spki.size()); | 67 memcpy(public_key.data(), spki.data(), spki.size()); |
| 68 *key = crypto::ECPrivateKey::CreateFromEncryptedPrivateKeyInfo( | 68 *key = crypto::ECPrivateKey::CreateFromEncryptedPrivateKeyInfo(private_key, |
| 69 ChannelIDService::kEPKIPassword, private_key, public_key); | 69 public_key); |
| 70 } | 70 } |
| 71 | 71 |
| 72 static base::Time GetTestCertExpirationTime() { | 72 static base::Time GetTestCertExpirationTime() { |
| 73 // Cert expiration time from 'openssl asn1parse -inform der -in | 73 // Cert expiration time from 'openssl asn1parse -inform der -in |
| 74 // unittest.originbound.der': | 74 // unittest.originbound.der': |
| 75 // UTCTIME :160507022239Z | 75 // UTCTIME :160507022239Z |
| 76 // base::Time::FromUTCExploded can't generate values past 2038 on 32-bit | 76 // base::Time::FromUTCExploded can't generate values past 2038 on 32-bit |
| 77 // linux, so we use the raw value here. | 77 // linux, so we use the raw value here. |
| 78 base::Time::Exploded exploded_time; | 78 base::Time::Exploded exploded_time; |
| 79 exploded_time.year = 2016; | 79 exploded_time.year = 2016; |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 sql::Statement smt(db.GetUniqueStatement( | 536 sql::Statement smt(db.GetUniqueStatement( |
| 537 "SELECT value FROM meta WHERE key = \"version\"")); | 537 "SELECT value FROM meta WHERE key = \"version\"")); |
| 538 ASSERT_TRUE(smt.Step()); | 538 ASSERT_TRUE(smt.Step()); |
| 539 EXPECT_EQ(5, smt.ColumnInt(0)); | 539 EXPECT_EQ(5, smt.ColumnInt(0)); |
| 540 EXPECT_FALSE(smt.Step()); | 540 EXPECT_FALSE(smt.Step()); |
| 541 } | 541 } |
| 542 } | 542 } |
| 543 } | 543 } |
| 544 | 544 |
| 545 } // namespace net | 545 } // namespace net |
| OLD | NEW |