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

Unified Diff: net/cert/internal/verify_certificate_chain_typed_unittest.h

Issue 2225493003: Don't treat trust anchors as certificates during path building. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address moar feedback Created 4 years, 4 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/cert/internal/verify_certificate_chain_typed_unittest.h
diff --git a/net/cert/internal/verify_certificate_chain_typed_unittest.h b/net/cert/internal/verify_certificate_chain_typed_unittest.h
index b4990a3a751d8f021f7a70c783f5d5ee92b0d4b3..b7265b33e75ed3ffa0a907b2d766b768d2c03294 100644
--- a/net/cert/internal/verify_certificate_chain_typed_unittest.h
+++ b/net/cert/internal/verify_certificate_chain_typed_unittest.h
@@ -10,6 +10,7 @@
#include "base/path_service.h"
#include "net/cert/internal/parsed_certificate.h"
#include "net/cert/internal/test_helpers.h"
+#include "net/cert/internal/trust_store.h"
#include "net/cert/pem_tokenizer.h"
#include "net/der/input.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -21,13 +22,13 @@ class VerifyCertificateChainTest : public ::testing::Test {
public:
void RunTest(const char* file_name) {
ParsedCertificateList chain;
- ParsedCertificateList roots;
+ TrustAnchors anchors;
der::GeneralizedTime time;
bool expected_result;
- ReadTestFromFile(file_name, &chain, &roots, &time, &expected_result);
+ ReadTestFromFile(file_name, &chain, &anchors, &time, &expected_result);
- TestDelegate::Verify(chain, roots, time, expected_result);
+ TestDelegate::Verify(chain, anchors, time, expected_result);
}
private:
@@ -54,11 +55,11 @@ class VerifyCertificateChainTest : public ::testing::Test {
// expected result of verification.
void ReadTestFromFile(const std::string& file_name,
ParsedCertificateList* chain,
- ParsedCertificateList* roots,
+ TrustAnchors* anchors,
der::GeneralizedTime* time,
bool* verify_result) {
chain->clear();
- roots->clear();
+ anchors->clear();
std::string file_data = ReadTestFileToString(file_name);
@@ -88,10 +89,14 @@ class VerifyCertificateChainTest : public ::testing::Test {
block_data.size(),
net::ParsedCertificate::DataSource::INTERNAL_COPY, {}, chain));
} else if (block_type == kTrustedCertificateHeader) {
- ASSERT_TRUE(net::ParsedCertificate::CreateAndAddToVector(
- reinterpret_cast<const uint8_t*>(block_data.data()),
- block_data.size(),
- net::ParsedCertificate::DataSource::INTERNAL_COPY, {}, roots));
+ scoped_refptr<ParsedCertificate> root =
+ net::ParsedCertificate::CreateFromCertificateData(
+ reinterpret_cast<const uint8_t*>(block_data.data()),
+ block_data.size(),
+ net::ParsedCertificate::DataSource::INTERNAL_COPY, {});
+ ASSERT_TRUE(root);
+ anchors->push_back(
+ TrustAnchor::CreateFromCertificateNoConstraints(std::move(root)));
} else if (block_type == kTimeHeader) {
ASSERT_FALSE(has_time) << "Duplicate " << kTimeHeader;
has_time = true;
« no previous file with comments | « net/cert/internal/verify_certificate_chain_pkits_unittest.cc ('k') | net/cert/internal/verify_certificate_chain_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698