| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/cert/internal/verify_certificate_chain.h" | 5 #include "net/cert/internal/verify_certificate_chain.h" |
| 6 | 6 |
| 7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
| 11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
| 13 #include "net/cert/internal/parse_certificate.h" | 13 #include "net/cert/internal/parse_certificate.h" |
| 14 #include "net/cert/internal/signature_policy.h" | 14 #include "net/cert/internal/signature_policy.h" |
| 15 #include "net/cert/internal/test_helpers.h" | 15 #include "net/cert/internal/test_helpers.h" |
| 16 #include "net/cert/pem_tokenizer.h" | 16 #include "net/cert/pem_tokenizer.h" |
| 17 #include "net/der/input.h" | 17 #include "net/der/input.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 19 | 19 |
| 20 // TODO(eroman): Because VerifySignedData() is only implemented for BoringSSL | |
| 21 // these tests also depend on BoringSSL. | |
| 22 #if defined(USE_OPENSSL) | |
| 23 | |
| 24 namespace net { | 20 namespace net { |
| 25 | 21 |
| 26 namespace { | 22 namespace { |
| 27 | 23 |
| 28 // Reads a data file from the unit-test data. | 24 // Reads a data file from the unit-test data. |
| 29 std::string ReadTestFileToString(const std::string& file_name) { | 25 std::string ReadTestFileToString(const std::string& file_name) { |
| 30 // Compute the full path, relative to the src/ directory. | 26 // Compute the full path, relative to the src/ directory. |
| 31 base::FilePath src_root; | 27 base::FilePath src_root; |
| 32 PathService::Get(base::DIR_SOURCE_ROOT, &src_root); | 28 PathService::Get(base::DIR_SOURCE_ROOT, &src_root); |
| 33 base::FilePath filepath = src_root.AppendASCII( | 29 base::FilePath filepath = src_root.AppendASCII( |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 ASSERT_FALSE( | 231 ASSERT_FALSE( |
| 236 VerifyCertificateChain(chain, trust_store, &signature_policy, time)); | 232 VerifyCertificateChain(chain, trust_store, &signature_policy, time)); |
| 237 } | 233 } |
| 238 | 234 |
| 239 // TODO(eroman): Add test that invalidate validity dates where the day or month | 235 // TODO(eroman): Add test that invalidate validity dates where the day or month |
| 240 // ordinal not in range, like "March 39, 2016" are rejected. | 236 // ordinal not in range, like "March 39, 2016" are rejected. |
| 241 | 237 |
| 242 } // namespace | 238 } // namespace |
| 243 | 239 |
| 244 } // namespace net | 240 } // namespace net |
| 245 | |
| 246 #endif | |
| OLD | NEW |