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

Side by Side Diff: net/cert/internal/path_builder_unittest.cc

Issue 2832703002: Allow the TrustStore interface to return matching intermediates, and identify distrusted certs. (Closed)
Patch Set: address comments Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/path_builder.h" 5 #include "net/cert/internal/path_builder.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 "net/cert/internal/cert_issuer_source_static.h" 10 #include "net/cert/internal/cert_issuer_source_static.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 } 130 }
131 131
132 protected: 132 protected:
133 scoped_refptr<ParsedCertificate> a_by_b_, b_by_c_, b_by_f_, c_by_d_, c_by_e_, 133 scoped_refptr<ParsedCertificate> a_by_b_, b_by_c_, b_by_f_, c_by_d_, c_by_e_,
134 d_by_d_, e_by_e_, f_by_e_; 134 d_by_d_, e_by_e_, f_by_e_;
135 135
136 SimpleSignaturePolicy signature_policy_; 136 SimpleSignaturePolicy signature_policy_;
137 der::GeneralizedTime time_ = {2017, 3, 1, 0, 0, 0}; 137 der::GeneralizedTime time_ = {2017, 3, 1, 0, 0, 0};
138 }; 138 };
139 139
140 void AddTrustedCertificate(scoped_refptr<ParsedCertificate> cert, 140 // Tests when the target cert has the same name and key as a trust anchor,
141 TrustStoreInMemory* trust_store) { 141 // however is signed by a different trust anchor. This should successfully build
142 ASSERT_TRUE(cert.get()); 142 // a path, however the trust anchor will be the signer of this cert.
143 scoped_refptr<TrustAnchor> anchor =
144 TrustAnchor::CreateFromCertificateNoConstraints(std::move(cert));
145 ASSERT_TRUE(anchor.get());
146 trust_store->AddTrustAnchor(std::move(anchor));
147 }
148
149 // If the target cert is has the same name and key as a trust anchor, however
150 // is signed but a different trust anchor. This should successfully build a
151 // path, however the trust anchor will be the signer of this cert.
152 // 143 //
153 // (This test is very similar to TestEndEntityHasSameNameAndSpkiAsTrustAnchor 144 // (This test is very similar to TestEndEntityHasSameNameAndSpkiAsTrustAnchor
154 // but with different data; also in this test the target cert itself is in the 145 // but with different data; also in this test the target cert itself is in the
155 // trust store). 146 // trust store).
156 TEST_F(PathBuilderMultiRootTest, TargetHasNameAndSpkiOfTrustAnchor) { 147 TEST_F(PathBuilderMultiRootTest, TargetHasNameAndSpkiOfTrustAnchor) {
157 TrustStoreInMemory trust_store; 148 TrustStoreInMemory trust_store;
158 AddTrustedCertificate(a_by_b_, &trust_store); 149 trust_store.AddTrustAnchor(a_by_b_);
159 AddTrustedCertificate(b_by_f_, &trust_store); 150 trust_store.AddTrustAnchor(b_by_f_);
160 151
161 CertPathBuilder::Result result; 152 CertPathBuilder::Result result;
162 CertPathBuilder path_builder(a_by_b_, &trust_store, &signature_policy_, time_, 153 CertPathBuilder path_builder(a_by_b_, &trust_store, &signature_policy_, time_,
163 KeyPurpose::ANY_EKU, &result); 154 KeyPurpose::ANY_EKU, &result);
164 155
165 path_builder.Run(); 156 path_builder.Run();
166 157
167 ASSERT_TRUE(result.HasValidPath()); 158 ASSERT_FALSE(result.HasValidPath());
168 const auto& path = result.GetBestValidPath()->path; 159
169 ASSERT_EQ(1U, path.certs.size()); 160 // TODO(eroman): This probably should have succeeded and found the path below.
170 EXPECT_EQ(a_by_b_, path.certs[0]); 161 // It fails right now because path building stops on trust anchors (and the
171 EXPECT_EQ(b_by_f_, path.trust_anchor->cert()); 162 // end entity is added as a trust anchor).
163 //
164 // const auto& path = result.GetBestValidPath()->path;
165 // ASSERT_EQ(2U, path.certs.size());
166 // EXPECT_EQ(a_by_b_, path.certs[0]);
167 // EXPECT_EQ(b_by_f_, path.certs[1]);
172 } 168 }
173 169
174 // If the target cert is has the same name and key as a trust anchor, however 170 // If the target cert is has the same name and key as a trust anchor, however
175 // is NOT itself signed by a trust anchor, it fails. Although the provided SPKI 171 // is NOT itself signed by a trust anchor, it fails. Although the provided SPKI
176 // is trusted, the certificate contents cannot be verified. 172 // is trusted, the certificate contents cannot be verified.
177 TEST_F(PathBuilderMultiRootTest, TargetWithSameNameAsTrustAnchorFails) { 173 TEST_F(PathBuilderMultiRootTest, TargetWithSameNameAsTrustAnchorFails) {
178 TrustStoreInMemory trust_store; 174 TrustStoreInMemory trust_store;
179 AddTrustedCertificate(a_by_b_, &trust_store); 175 trust_store.AddTrustAnchor(a_by_b_);
180 176
181 CertPathBuilder::Result result; 177 CertPathBuilder::Result result;
182 CertPathBuilder path_builder(a_by_b_, &trust_store, &signature_policy_, time_, 178 CertPathBuilder path_builder(a_by_b_, &trust_store, &signature_policy_, time_,
183 KeyPurpose::ANY_EKU, &result); 179 KeyPurpose::ANY_EKU, &result);
184 180
185 path_builder.Run(); 181 path_builder.Run();
186 182
187 EXPECT_FALSE(result.HasValidPath()); 183 EXPECT_FALSE(result.HasValidPath());
188 } 184 }
189 185
190 // Test a failed path building when the trust anchor is provided as a 186 // Test a failed path building when the trust anchor is provided as a
191 // supplemental certificate. Conceptually the following paths can be built: 187 // supplemental certificate. Conceptually the following paths could be built:
192 // 188 //
193 // B(C) <- C(D) <- [Trust anchor D] 189 // B(C) <- C(D) <- [Trust anchor D]
194 // B(C) <- C(D) <- D(D) <- [Trust anchor D] 190 // B(C) <- C(D) <- D(D) <- [Trust anchor D]
195 // 191 //
196 // The second one is extraneous given the shorter one, however path building 192 // However the second one is extraneous given the shorter path.
197 // will enumerate it if the shorter one failed validation.
198 TEST_F(PathBuilderMultiRootTest, SelfSignedTrustAnchorSupplementalCert) { 193 TEST_F(PathBuilderMultiRootTest, SelfSignedTrustAnchorSupplementalCert) {
199 TrustStoreInMemory trust_store; 194 TrustStoreInMemory trust_store;
200 AddTrustedCertificate(d_by_d_, &trust_store); 195 trust_store.AddTrustAnchor(d_by_d_);
201 196
202 // The (extraneous) trust anchor D(D) is supplied as a certificate, as is the 197 // The (extraneous) trust anchor D(D) is supplied as a certificate, as is the
203 // intermediate needed for path building C(D). 198 // intermediate needed for path building C(D).
204 CertIssuerSourceStatic sync_certs; 199 CertIssuerSourceStatic sync_certs;
205 sync_certs.AddCert(d_by_d_); 200 sync_certs.AddCert(d_by_d_);
206 sync_certs.AddCert(c_by_d_); 201 sync_certs.AddCert(c_by_d_);
207 202
208 // C(D) is not valid at this time, so path building will fail. 203 // C(D) is not valid at this time, so path building will fail.
209 der::GeneralizedTime expired_time = {2016, 1, 1, 0, 0, 0}; 204 der::GeneralizedTime expired_time = {2016, 1, 1, 0, 0, 0};
210 205
211 CertPathBuilder::Result result; 206 CertPathBuilder::Result result;
212 CertPathBuilder path_builder(b_by_c_, &trust_store, &signature_policy_, 207 CertPathBuilder path_builder(b_by_c_, &trust_store, &signature_policy_,
213 expired_time, KeyPurpose::ANY_EKU, &result); 208 expired_time, KeyPurpose::ANY_EKU, &result);
214 path_builder.AddCertIssuerSource(&sync_certs); 209 path_builder.AddCertIssuerSource(&sync_certs);
215 210
216 path_builder.Run(); 211 path_builder.Run();
217 212
218 EXPECT_FALSE(result.HasValidPath()); 213 EXPECT_FALSE(result.HasValidPath());
219 ASSERT_EQ(2U, result.paths.size()); 214 ASSERT_EQ(1U, result.paths.size());
220 215
221 EXPECT_FALSE(result.paths[0]->IsValid()); 216 EXPECT_FALSE(result.paths[0]->IsValid());
222 const auto& path0 = result.paths[0]->path; 217 const auto& path0 = result.paths[0]->path;
223 ASSERT_EQ(2U, path0.certs.size()); 218 ASSERT_EQ(3U, path0.certs.size());
224 EXPECT_EQ(b_by_c_, path0.certs[0]); 219 EXPECT_EQ(b_by_c_, path0.certs[0]);
225 EXPECT_EQ(c_by_d_, path0.certs[1]); 220 EXPECT_EQ(c_by_d_, path0.certs[1]);
226 EXPECT_EQ(d_by_d_, path0.trust_anchor->cert()); 221 EXPECT_EQ(d_by_d_, path0.certs[2]);
227
228 const auto& path1 = result.paths[1]->path;
229 ASSERT_EQ(3U, path1.certs.size());
230 EXPECT_EQ(b_by_c_, path1.certs[0]);
231 EXPECT_EQ(c_by_d_, path1.certs[1]);
232 EXPECT_EQ(d_by_d_, path1.certs[2]);
233 EXPECT_EQ(d_by_d_, path1.trust_anchor->cert());
234 } 222 }
235 223
236 // If the target cert is a self-signed cert whose key is a trust anchor, it 224 // Test verifying a certificate that is a trust anchor.
237 // should verify.
238 TEST_F(PathBuilderMultiRootTest, TargetIsSelfSignedTrustAnchor) { 225 TEST_F(PathBuilderMultiRootTest, TargetIsSelfSignedTrustAnchor) {
239 TrustStoreInMemory trust_store; 226 TrustStoreInMemory trust_store;
240 AddTrustedCertificate(e_by_e_, &trust_store); 227 trust_store.AddTrustAnchor(e_by_e_);
241 // This is not necessary for the test, just an extra... 228 // This is not necessary for the test, just an extra...
242 AddTrustedCertificate(f_by_e_, &trust_store); 229 trust_store.AddTrustAnchor(f_by_e_);
243 230
244 CertPathBuilder::Result result; 231 CertPathBuilder::Result result;
245 CertPathBuilder path_builder(e_by_e_, &trust_store, &signature_policy_, time_, 232 CertPathBuilder path_builder(e_by_e_, &trust_store, &signature_policy_, time_,
246 KeyPurpose::ANY_EKU, &result); 233 KeyPurpose::ANY_EKU, &result);
247 234
248 path_builder.Run(); 235 path_builder.Run();
249 236
250 ASSERT_TRUE(result.HasValidPath()); 237 ASSERT_FALSE(result.HasValidPath());
251 const auto& path = result.GetBestValidPath()->path; 238
252 ASSERT_EQ(1U, path.certs.size()); 239 // TODO(eroman): This test currently fails because path building stops
253 EXPECT_EQ(e_by_e_, path.certs[0]); 240 // searching once it identifies a certificate as a trust anchor. In this case
254 EXPECT_EQ(e_by_e_, path.trust_anchor->cert()); 241 // the target is a trust anchor, however could be verified using the
242 // self-signedness (or even the cert itself).
243 // const auto& path = result.GetBestValidPath()->path;
244 // ASSERT_EQ(2U, path.certs.size());
245 // EXPECT_EQ(e_by_e_, path.certs[0]);
246 // EXPECT_EQ(e_by_e_, path.certs[1]);
255 } 247 }
256 248
257 // If the target cert is directly issued by a trust anchor, it should verify 249 // If the target cert is directly issued by a trust anchor, it should verify
258 // without any intermediate certs being provided. 250 // without any intermediate certs being provided.
259 TEST_F(PathBuilderMultiRootTest, TargetDirectlySignedByTrustAnchor) { 251 TEST_F(PathBuilderMultiRootTest, TargetDirectlySignedByTrustAnchor) {
260 TrustStoreInMemory trust_store; 252 TrustStoreInMemory trust_store;
261 AddTrustedCertificate(b_by_f_, &trust_store); 253 trust_store.AddTrustAnchor(b_by_f_);
262 254
263 CertPathBuilder::Result result; 255 CertPathBuilder::Result result;
264 CertPathBuilder path_builder(a_by_b_, &trust_store, &signature_policy_, time_, 256 CertPathBuilder path_builder(a_by_b_, &trust_store, &signature_policy_, time_,
265 KeyPurpose::ANY_EKU, &result); 257 KeyPurpose::ANY_EKU, &result);
266 258
267 path_builder.Run(); 259 path_builder.Run();
268 260
269 ASSERT_TRUE(result.HasValidPath()); 261 ASSERT_TRUE(result.HasValidPath());
270 const auto& path = result.GetBestValidPath()->path; 262 const auto& path = result.GetBestValidPath()->path;
271 ASSERT_EQ(1U, path.certs.size()); 263 ASSERT_EQ(2U, path.certs.size());
272 EXPECT_EQ(a_by_b_, path.certs[0]); 264 EXPECT_EQ(a_by_b_, path.certs[0]);
273 EXPECT_EQ(b_by_f_, path.trust_anchor->cert()); 265 EXPECT_EQ(b_by_f_, path.certs[1]);
274 } 266 }
275 267
276 // Test that async cert queries are not made if the path can be successfully 268 // Test that async cert queries are not made if the path can be successfully
277 // built with synchronously available certs. 269 // built with synchronously available certs.
278 TEST_F(PathBuilderMultiRootTest, TriesSyncFirst) { 270 TEST_F(PathBuilderMultiRootTest, TriesSyncFirst) {
279 TrustStoreInMemory trust_store; 271 TrustStoreInMemory trust_store;
280 AddTrustedCertificate(e_by_e_, &trust_store); 272 trust_store.AddTrustAnchor(e_by_e_);
281 273
282 CertIssuerSourceStatic sync_certs; 274 CertIssuerSourceStatic sync_certs;
283 sync_certs.AddCert(b_by_f_); 275 sync_certs.AddCert(b_by_f_);
284 sync_certs.AddCert(f_by_e_); 276 sync_certs.AddCert(f_by_e_);
285 277
286 AsyncCertIssuerSourceStatic async_certs; 278 AsyncCertIssuerSourceStatic async_certs;
287 async_certs.AddCert(b_by_c_); 279 async_certs.AddCert(b_by_c_);
288 async_certs.AddCert(c_by_e_); 280 async_certs.AddCert(c_by_e_);
289 281
290 CertPathBuilder::Result result; 282 CertPathBuilder::Result result;
291 CertPathBuilder path_builder(a_by_b_, &trust_store, &signature_policy_, time_, 283 CertPathBuilder path_builder(a_by_b_, &trust_store, &signature_policy_, time_,
292 KeyPurpose::ANY_EKU, &result); 284 KeyPurpose::ANY_EKU, &result);
293 path_builder.AddCertIssuerSource(&async_certs); 285 path_builder.AddCertIssuerSource(&async_certs);
294 path_builder.AddCertIssuerSource(&sync_certs); 286 path_builder.AddCertIssuerSource(&sync_certs);
295 287
296 path_builder.Run(); 288 path_builder.Run();
297 289
298 EXPECT_TRUE(result.HasValidPath()); 290 EXPECT_TRUE(result.HasValidPath());
299 EXPECT_EQ(0, async_certs.num_async_gets()); 291 EXPECT_EQ(0, async_certs.num_async_gets());
300 } 292 }
301 293
302 // If async queries are needed, all async sources will be queried 294 // If async queries are needed, all async sources will be queried
303 // simultaneously. 295 // simultaneously.
304 TEST_F(PathBuilderMultiRootTest, TestAsyncSimultaneous) { 296 TEST_F(PathBuilderMultiRootTest, TestAsyncSimultaneous) {
305 TrustStoreInMemory trust_store; 297 TrustStoreInMemory trust_store;
306 AddTrustedCertificate(e_by_e_, &trust_store); 298 trust_store.AddTrustAnchor(e_by_e_);
307 299
308 CertIssuerSourceStatic sync_certs; 300 CertIssuerSourceStatic sync_certs;
309 sync_certs.AddCert(b_by_c_); 301 sync_certs.AddCert(b_by_c_);
310 sync_certs.AddCert(b_by_f_); 302 sync_certs.AddCert(b_by_f_);
311 303
312 AsyncCertIssuerSourceStatic async_certs1; 304 AsyncCertIssuerSourceStatic async_certs1;
313 async_certs1.AddCert(c_by_e_); 305 async_certs1.AddCert(c_by_e_);
314 306
315 AsyncCertIssuerSourceStatic async_certs2; 307 AsyncCertIssuerSourceStatic async_certs2;
316 async_certs2.AddCert(f_by_e_); 308 async_certs2.AddCert(f_by_e_);
(...skipping 10 matching lines...) Expand all
327 EXPECT_TRUE(result.HasValidPath()); 319 EXPECT_TRUE(result.HasValidPath());
328 EXPECT_EQ(1, async_certs1.num_async_gets()); 320 EXPECT_EQ(1, async_certs1.num_async_gets());
329 EXPECT_EQ(1, async_certs2.num_async_gets()); 321 EXPECT_EQ(1, async_certs2.num_async_gets());
330 } 322 }
331 323
332 // Test that PathBuilder does not generate longer paths than necessary if one of 324 // Test that PathBuilder does not generate longer paths than necessary if one of
333 // the supplied certs is itself a trust anchor. 325 // the supplied certs is itself a trust anchor.
334 TEST_F(PathBuilderMultiRootTest, TestLongChain) { 326 TEST_F(PathBuilderMultiRootTest, TestLongChain) {
335 // Both D(D) and C(D) are trusted roots. 327 // Both D(D) and C(D) are trusted roots.
336 TrustStoreInMemory trust_store; 328 TrustStoreInMemory trust_store;
337 AddTrustedCertificate(d_by_d_, &trust_store); 329 trust_store.AddTrustAnchor(d_by_d_);
338 AddTrustedCertificate(c_by_d_, &trust_store); 330 trust_store.AddTrustAnchor(c_by_d_);
339 331
340 // Certs B(C), and C(D) are all supplied. 332 // Certs B(C), and C(D) are all supplied.
341 CertIssuerSourceStatic sync_certs; 333 CertIssuerSourceStatic sync_certs;
342 sync_certs.AddCert(b_by_c_); 334 sync_certs.AddCert(b_by_c_);
343 sync_certs.AddCert(c_by_d_); 335 sync_certs.AddCert(c_by_d_);
344 336
345 CertPathBuilder::Result result; 337 CertPathBuilder::Result result;
346 CertPathBuilder path_builder(a_by_b_, &trust_store, &signature_policy_, time_, 338 CertPathBuilder path_builder(a_by_b_, &trust_store, &signature_policy_, time_,
347 KeyPurpose::ANY_EKU, &result); 339 KeyPurpose::ANY_EKU, &result);
348 path_builder.AddCertIssuerSource(&sync_certs); 340 path_builder.AddCertIssuerSource(&sync_certs);
349 341
350 path_builder.Run(); 342 path_builder.Run();
351 343
352 ASSERT_TRUE(result.HasValidPath()); 344 ASSERT_TRUE(result.HasValidPath());
353 345
354 // The result path should be A(B) <- B(C) <- C(D) 346 // The result path should be A(B) <- B(C) <- C(D)
355 // not the longer but also valid A(B) <- B(C) <- C(D) <- D(D) 347 // not the longer but also valid A(B) <- B(C) <- C(D) <- D(D)
356 EXPECT_EQ(2U, result.GetBestValidPath()->path.certs.size()); 348 EXPECT_EQ(3U, result.GetBestValidPath()->path.certs.size());
357 } 349 }
358 350
359 // Test that PathBuilder will backtrack and try a different path if the first 351 // Test that PathBuilder will backtrack and try a different path if the first
360 // one doesn't work out. 352 // one doesn't work out.
361 TEST_F(PathBuilderMultiRootTest, TestBacktracking) { 353 TEST_F(PathBuilderMultiRootTest, TestBacktracking) {
362 // Only D(D) is a trusted root. 354 // Only D(D) is a trusted root.
363 TrustStoreInMemory trust_store; 355 TrustStoreInMemory trust_store;
364 AddTrustedCertificate(d_by_d_, &trust_store); 356 trust_store.AddTrustAnchor(d_by_d_);
365 357
366 // Certs B(F) and F(E) are supplied synchronously, thus the path 358 // Certs B(F) and F(E) are supplied synchronously, thus the path
367 // A(B) <- B(F) <- F(E) should be built first, though it won't verify. 359 // A(B) <- B(F) <- F(E) should be built first, though it won't verify.
368 CertIssuerSourceStatic sync_certs; 360 CertIssuerSourceStatic sync_certs;
369 sync_certs.AddCert(b_by_f_); 361 sync_certs.AddCert(b_by_f_);
370 sync_certs.AddCert(f_by_e_); 362 sync_certs.AddCert(f_by_e_);
371 363
372 // Certs B(C), and C(D) are supplied asynchronously, so the path 364 // Certs B(C), and C(D) are supplied asynchronously, so the path
373 // A(B) <- B(C) <- C(D) <- D(D) should be tried second. 365 // A(B) <- B(C) <- C(D) <- D(D) should be tried second.
374 AsyncCertIssuerSourceStatic async_certs; 366 AsyncCertIssuerSourceStatic async_certs;
375 async_certs.AddCert(b_by_c_); 367 async_certs.AddCert(b_by_c_);
376 async_certs.AddCert(c_by_d_); 368 async_certs.AddCert(c_by_d_);
377 369
378 CertPathBuilder::Result result; 370 CertPathBuilder::Result result;
379 CertPathBuilder path_builder(a_by_b_, &trust_store, &signature_policy_, time_, 371 CertPathBuilder path_builder(a_by_b_, &trust_store, &signature_policy_, time_,
380 KeyPurpose::ANY_EKU, &result); 372 KeyPurpose::ANY_EKU, &result);
381 path_builder.AddCertIssuerSource(&sync_certs); 373 path_builder.AddCertIssuerSource(&sync_certs);
382 path_builder.AddCertIssuerSource(&async_certs); 374 path_builder.AddCertIssuerSource(&async_certs);
383 375
384 path_builder.Run(); 376 path_builder.Run();
385 377
386 ASSERT_TRUE(result.HasValidPath()); 378 ASSERT_TRUE(result.HasValidPath());
387 379
388 // The result path should be A(B) <- B(C) <- C(D) <- D(D) 380 // The result path should be A(B) <- B(C) <- C(D) <- D(D)
389 const auto& path = result.GetBestValidPath()->path; 381 const auto& path = result.GetBestValidPath()->path;
390 ASSERT_EQ(3U, path.certs.size()); 382 ASSERT_EQ(4U, path.certs.size());
391 EXPECT_EQ(a_by_b_, path.certs[0]); 383 EXPECT_EQ(a_by_b_, path.certs[0]);
392 EXPECT_EQ(b_by_c_, path.certs[1]); 384 EXPECT_EQ(b_by_c_, path.certs[1]);
393 EXPECT_EQ(c_by_d_, path.certs[2]); 385 EXPECT_EQ(c_by_d_, path.certs[2]);
394 EXPECT_EQ(d_by_d_, path.trust_anchor->cert()); 386 EXPECT_EQ(d_by_d_, path.certs[3]);
395 } 387 }
396 388
397 // Test that whichever order CertIssuerSource returns the issuers, the path 389 // Test that whichever order CertIssuerSource returns the issuers, the path
398 // building still succeeds. 390 // building still succeeds.
399 TEST_F(PathBuilderMultiRootTest, TestCertIssuerOrdering) { 391 TEST_F(PathBuilderMultiRootTest, TestCertIssuerOrdering) {
400 // Only D(D) is a trusted root. 392 // Only D(D) is a trusted root.
401 TrustStoreInMemory trust_store; 393 TrustStoreInMemory trust_store;
402 AddTrustedCertificate(d_by_d_, &trust_store); 394 trust_store.AddTrustAnchor(d_by_d_);
403 395
404 for (bool reverse_order : {false, true}) { 396 for (bool reverse_order : {false, true}) {
405 SCOPED_TRACE(reverse_order); 397 SCOPED_TRACE(reverse_order);
406 std::vector<scoped_refptr<ParsedCertificate>> certs = { 398 std::vector<scoped_refptr<ParsedCertificate>> certs = {
407 b_by_c_, b_by_f_, f_by_e_, c_by_d_, c_by_e_}; 399 b_by_c_, b_by_f_, f_by_e_, c_by_d_, c_by_e_};
408 CertIssuerSourceStatic sync_certs; 400 CertIssuerSourceStatic sync_certs;
409 if (reverse_order) { 401 if (reverse_order) {
410 for (auto it = certs.rbegin(); it != certs.rend(); ++it) 402 for (auto it = certs.rbegin(); it != certs.rend(); ++it)
411 sync_certs.AddCert(*it); 403 sync_certs.AddCert(*it);
412 } else { 404 } else {
413 for (const auto& cert : certs) 405 for (const auto& cert : certs)
414 sync_certs.AddCert(cert); 406 sync_certs.AddCert(cert);
415 } 407 }
416 408
417 CertPathBuilder::Result result; 409 CertPathBuilder::Result result;
418 CertPathBuilder path_builder(a_by_b_, &trust_store, &signature_policy_, 410 CertPathBuilder path_builder(a_by_b_, &trust_store, &signature_policy_,
419 time_, KeyPurpose::ANY_EKU, &result); 411 time_, KeyPurpose::ANY_EKU, &result);
420 path_builder.AddCertIssuerSource(&sync_certs); 412 path_builder.AddCertIssuerSource(&sync_certs);
421 413
422 path_builder.Run(); 414 path_builder.Run();
423 415
424 ASSERT_TRUE(result.HasValidPath()); 416 ASSERT_TRUE(result.HasValidPath());
425 417
426 // The result path should be A(B) <- B(C) <- C(D) <- D(D) 418 // The result path should be A(B) <- B(C) <- C(D) <- D(D)
427 const auto& path = result.GetBestValidPath()->path; 419 const auto& path = result.GetBestValidPath()->path;
428 ASSERT_EQ(3U, path.certs.size()); 420 ASSERT_EQ(4U, path.certs.size());
429 EXPECT_EQ(a_by_b_, path.certs[0]); 421 EXPECT_EQ(a_by_b_, path.certs[0]);
430 EXPECT_EQ(b_by_c_, path.certs[1]); 422 EXPECT_EQ(b_by_c_, path.certs[1]);
431 EXPECT_EQ(c_by_d_, path.certs[2]); 423 EXPECT_EQ(c_by_d_, path.certs[2]);
432 EXPECT_EQ(d_by_d_, path.trust_anchor->cert()); 424 EXPECT_EQ(d_by_d_, path.certs[3]);
433 } 425 }
434 } 426 }
435 427
436 class PathBuilderKeyRolloverTest : public ::testing::Test { 428 class PathBuilderKeyRolloverTest : public ::testing::Test {
437 public: 429 public:
438 PathBuilderKeyRolloverTest() : signature_policy_(1024) {} 430 PathBuilderKeyRolloverTest() : signature_policy_(1024) {}
439 431
440 void SetUp() override { 432 void SetUp() override {
441 ParsedCertificateList path; 433 ParsedCertificateList path;
442 434
443 VerifyCertChainTest test; 435 VerifyCertChainTest test;
444 ReadVerifyCertChainTestFromFile( 436 ReadVerifyCertChainTestFromFile(
445 "net/data/verify_certificate_chain_unittest/key-rollover-oldchain.pem", 437 "net/data/verify_certificate_chain_unittest/key-rollover-oldchain.pem",
446 &test); 438 &test);
447 path = test.chain; 439 path = test.chain;
448 oldroot_ = test.trust_anchor; 440 ASSERT_EQ(3U, path.size());
441 target_ = path[0];
442 oldintermediate_ = path[1];
443 oldroot_ = path[2];
449 time_ = test.time; 444 time_ = test.time;
450 445
451 ASSERT_EQ(2U, path.size());
452 target_ = path[0];
453 oldintermediate_ = path[1];
454 ASSERT_TRUE(target_); 446 ASSERT_TRUE(target_);
455 ASSERT_TRUE(oldintermediate_); 447 ASSERT_TRUE(oldintermediate_);
456 448
457 ReadVerifyCertChainTestFromFile( 449 ReadVerifyCertChainTestFromFile(
458 "net/data/verify_certificate_chain_unittest/" 450 "net/data/verify_certificate_chain_unittest/"
459 "key-rollover-longrolloverchain.pem", 451 "key-rollover-longrolloverchain.pem",
460 &test); 452 &test);
461 path = test.chain; 453 path = test.chain;
462 454
463 ASSERT_EQ(4U, path.size()); 455 ASSERT_EQ(5U, path.size());
464 newintermediate_ = path[1]; 456 newintermediate_ = path[1];
465 newroot_ = path[2]; 457 newroot_ = path[2];
466 newrootrollover_ = path[3]; 458 newrootrollover_ = path[3];
467 ASSERT_TRUE(newintermediate_); 459 ASSERT_TRUE(newintermediate_);
468 ASSERT_TRUE(newroot_); 460 ASSERT_TRUE(newroot_);
469 ASSERT_TRUE(newrootrollover_); 461 ASSERT_TRUE(newrootrollover_);
470 } 462 }
471 463
472 protected: 464 protected:
473 // oldroot-------->newrootrollover newroot 465 // oldroot-------->newrootrollover newroot
474 // | | | 466 // | | |
475 // v v v 467 // v v v
476 // oldintermediate newintermediate 468 // oldintermediate newintermediate
477 // | | 469 // | |
478 // +------------+-------------+ 470 // +------------+-------------+
479 // | 471 // |
480 // v 472 // v
481 // target 473 // target
482 scoped_refptr<ParsedCertificate> target_; 474 scoped_refptr<ParsedCertificate> target_;
483 scoped_refptr<ParsedCertificate> oldintermediate_; 475 scoped_refptr<ParsedCertificate> oldintermediate_;
484 scoped_refptr<ParsedCertificate> newintermediate_; 476 scoped_refptr<ParsedCertificate> newintermediate_;
485 scoped_refptr<TrustAnchor> oldroot_; 477 scoped_refptr<ParsedCertificate> oldroot_;
486 scoped_refptr<ParsedCertificate> newroot_; 478 scoped_refptr<ParsedCertificate> newroot_;
487 scoped_refptr<ParsedCertificate> newrootrollover_; 479 scoped_refptr<ParsedCertificate> newrootrollover_;
488 480
489 SimpleSignaturePolicy signature_policy_; 481 SimpleSignaturePolicy signature_policy_;
490 der::GeneralizedTime time_; 482 der::GeneralizedTime time_;
491 }; 483 };
492 484
493 // Tests that if only the old root cert is trusted, the path builder can build a 485 // Tests that if only the old root cert is trusted, the path builder can build a
494 // path through the new intermediate and rollover cert to the old root. 486 // path through the new intermediate and rollover cert to the old root.
495 TEST_F(PathBuilderKeyRolloverTest, TestRolloverOnlyOldRootTrusted) { 487 TEST_F(PathBuilderKeyRolloverTest, TestRolloverOnlyOldRootTrusted) {
(...skipping 14 matching lines...) Expand all
510 502
511 path_builder.Run(); 503 path_builder.Run();
512 504
513 EXPECT_TRUE(result.HasValidPath()); 505 EXPECT_TRUE(result.HasValidPath());
514 506
515 // Path builder will first attempt: target <- newintermediate <- oldroot 507 // Path builder will first attempt: target <- newintermediate <- oldroot
516 // but it will fail since newintermediate is signed by newroot. 508 // but it will fail since newintermediate is signed by newroot.
517 ASSERT_EQ(2U, result.paths.size()); 509 ASSERT_EQ(2U, result.paths.size());
518 const auto& path0 = result.paths[0]->path; 510 const auto& path0 = result.paths[0]->path;
519 EXPECT_FALSE(result.paths[0]->IsValid()); 511 EXPECT_FALSE(result.paths[0]->IsValid());
520 ASSERT_EQ(2U, path0.certs.size()); 512 ASSERT_EQ(3U, path0.certs.size());
521 EXPECT_EQ(target_, path0.certs[0]); 513 EXPECT_EQ(target_, path0.certs[0]);
522 EXPECT_EQ(newintermediate_, path0.certs[1]); 514 EXPECT_EQ(newintermediate_, path0.certs[1]);
523 EXPECT_EQ(oldroot_, path0.trust_anchor); 515 EXPECT_EQ(oldroot_, path0.certs[2]);
524 516
525 // Path builder will next attempt: 517 // Path builder will next attempt:
526 // target <- newintermediate <- newrootrollover <- oldroot 518 // target <- newintermediate <- newrootrollover <- oldroot
527 // which will succeed. 519 // which will succeed.
528 const auto& path1 = result.paths[1]->path; 520 const auto& path1 = result.paths[1]->path;
529 EXPECT_EQ(1U, result.best_result_index); 521 EXPECT_EQ(1U, result.best_result_index);
530 EXPECT_TRUE(result.paths[1]->IsValid()); 522 EXPECT_TRUE(result.paths[1]->IsValid());
531 ASSERT_EQ(3U, path1.certs.size()); 523 ASSERT_EQ(4U, path1.certs.size());
532 EXPECT_EQ(target_, path1.certs[0]); 524 EXPECT_EQ(target_, path1.certs[0]);
533 EXPECT_EQ(newintermediate_, path1.certs[1]); 525 EXPECT_EQ(newintermediate_, path1.certs[1]);
534 EXPECT_EQ(newrootrollover_, path1.certs[2]); 526 EXPECT_EQ(newrootrollover_, path1.certs[2]);
535 EXPECT_EQ(oldroot_, path1.trust_anchor); 527 EXPECT_EQ(oldroot_, path1.certs[3]);
536 } 528 }
537 529
538 // Tests that if both old and new roots are trusted it can build a path through 530 // Tests that if both old and new roots are trusted it can build a path through
539 // either. 531 // either.
540 // TODO(mattm): Once prioritization is implemented, it should test that it 532 // TODO(mattm): Once prioritization is implemented, it should test that it
541 // always builds the path through the new intermediate and new root. 533 // always builds the path through the new intermediate and new root.
542 TEST_F(PathBuilderKeyRolloverTest, TestRolloverBothRootsTrusted) { 534 TEST_F(PathBuilderKeyRolloverTest, TestRolloverBothRootsTrusted) {
543 // Both oldroot and newroot are trusted. 535 // Both oldroot and newroot are trusted.
544 TrustStoreInMemory trust_store; 536 TrustStoreInMemory trust_store;
545 trust_store.AddTrustAnchor(oldroot_); 537 trust_store.AddTrustAnchor(oldroot_);
546 AddTrustedCertificate(newroot_, &trust_store); 538 trust_store.AddTrustAnchor(newroot_);
547 539
548 // Both old and new intermediates + rollover cert are provided. 540 // Both old and new intermediates + rollover cert are provided.
549 CertIssuerSourceStatic sync_certs; 541 CertIssuerSourceStatic sync_certs;
550 sync_certs.AddCert(oldintermediate_); 542 sync_certs.AddCert(oldintermediate_);
551 sync_certs.AddCert(newintermediate_); 543 sync_certs.AddCert(newintermediate_);
552 sync_certs.AddCert(newrootrollover_); 544 sync_certs.AddCert(newrootrollover_);
553 545
554 CertPathBuilder::Result result; 546 CertPathBuilder::Result result;
555 CertPathBuilder path_builder(target_, &trust_store, &signature_policy_, time_, 547 CertPathBuilder path_builder(target_, &trust_store, &signature_policy_, time_,
556 KeyPurpose::ANY_EKU, &result); 548 KeyPurpose::ANY_EKU, &result);
557 path_builder.AddCertIssuerSource(&sync_certs); 549 path_builder.AddCertIssuerSource(&sync_certs);
558 550
559 path_builder.Run(); 551 path_builder.Run();
560 552
561 EXPECT_TRUE(result.HasValidPath()); 553 EXPECT_TRUE(result.HasValidPath());
562 554
563 // Path builder willattempt one of: 555 // Path builder willattempt one of:
564 // target <- oldintermediate <- oldroot 556 // target <- oldintermediate <- oldroot
565 // target <- newintermediate <- newroot 557 // target <- newintermediate <- newroot
566 // either will succeed. 558 // either will succeed.
567 ASSERT_EQ(1U, result.paths.size()); 559 ASSERT_EQ(1U, result.paths.size());
568 const auto& path = result.paths[0]->path; 560 const auto& path = result.paths[0]->path;
569 EXPECT_TRUE(result.paths[0]->IsValid()); 561 EXPECT_TRUE(result.paths[0]->IsValid());
570 ASSERT_EQ(2U, path.certs.size()); 562 ASSERT_EQ(3U, path.certs.size());
571 EXPECT_EQ(target_, path.certs[0]); 563 EXPECT_EQ(target_, path.certs[0]);
572 if (path.certs[1] != newintermediate_) { 564 if (path.certs[1] != newintermediate_) {
573 DVLOG(1) << "USED OLD"; 565 DVLOG(1) << "USED OLD";
574 EXPECT_EQ(oldintermediate_, path.certs[1]); 566 EXPECT_EQ(oldintermediate_, path.certs[1]);
575 EXPECT_EQ(oldroot_, path.trust_anchor); 567 EXPECT_EQ(oldroot_, path.certs[2]);
576 } else { 568 } else {
577 DVLOG(1) << "USED NEW"; 569 DVLOG(1) << "USED NEW";
578 EXPECT_EQ(newintermediate_, path.certs[1]); 570 EXPECT_EQ(newintermediate_, path.certs[1]);
579 EXPECT_EQ(newroot_, path.trust_anchor->cert()); 571 EXPECT_EQ(newroot_, path.certs[2]);
580 } 572 }
581 } 573 }
582 574
583 // If trust anchor query returned no results, and there are no issuer 575 // If trust anchor query returned no results, and there are no issuer
584 // sources, path building should fail at that point. 576 // sources, path building should fail at that point.
585 TEST_F(PathBuilderKeyRolloverTest, TestAnchorsNoMatchAndNoIssuerSources) { 577 TEST_F(PathBuilderKeyRolloverTest, TestAnchorsNoMatchAndNoIssuerSources) {
586 TrustStoreInMemory trust_store; 578 TrustStoreInMemory trust_store;
587 trust_store.AddTrustAnchor( 579 trust_store.AddTrustAnchor(newroot_);
588 TrustAnchor::CreateFromCertificateNoConstraints(newroot_));
589 580
590 CertPathBuilder::Result result; 581 CertPathBuilder::Result result;
591 CertPathBuilder path_builder(target_, &trust_store, &signature_policy_, time_, 582 CertPathBuilder path_builder(target_, &trust_store, &signature_policy_, time_,
592 KeyPurpose::ANY_EKU, &result); 583 KeyPurpose::ANY_EKU, &result);
593 584
594 path_builder.Run(); 585 path_builder.Run();
595 586
596 EXPECT_FALSE(result.HasValidPath()); 587 EXPECT_FALSE(result.HasValidPath());
597 588
598 ASSERT_EQ(0U, result.paths.size()); 589 ASSERT_EQ(0U, result.paths.size());
599 } 590 }
600 591
601 // Tests that multiple trust root matches on a single path will be considered. 592 // Tests that multiple trust root matches on a single path will be considered.
602 // Both roots have the same subject but different keys. Only one of them will 593 // Both roots have the same subject but different keys. Only one of them will
603 // verify. 594 // verify.
604 TEST_F(PathBuilderKeyRolloverTest, TestMultipleRootMatchesOnlyOneWorks) { 595 TEST_F(PathBuilderKeyRolloverTest, TestMultipleRootMatchesOnlyOneWorks) {
605 TrustStoreCollection trust_store_collection; 596 TrustStoreCollection trust_store_collection;
606 TrustStoreInMemory trust_store1; 597 TrustStoreInMemory trust_store1;
607 TrustStoreInMemory trust_store2; 598 TrustStoreInMemory trust_store2;
608 trust_store_collection.AddTrustStore(&trust_store1); 599 trust_store_collection.AddTrustStore(&trust_store1);
609 trust_store_collection.AddTrustStore(&trust_store2); 600 trust_store_collection.AddTrustStore(&trust_store2);
610 // Add two trust anchors (newroot_ and oldroot_). Path building will attempt 601 // Add two trust anchors (newroot_ and oldroot_). Path building will attempt
611 // them in this same order, as trust_store1 was added to 602 // them in this same order, as trust_store1 was added to
612 // trust_store_collection first. 603 // trust_store_collection first.
613 trust_store1.AddTrustAnchor( 604 trust_store1.AddTrustAnchor(newroot_);
614 TrustAnchor::CreateFromCertificateNoConstraints(newroot_));
615 trust_store2.AddTrustAnchor(oldroot_); 605 trust_store2.AddTrustAnchor(oldroot_);
616 606
617 // Only oldintermediate is supplied, so the path with newroot should fail, 607 // Only oldintermediate is supplied, so the path with newroot should fail,
618 // oldroot should succeed. 608 // oldroot should succeed.
619 CertIssuerSourceStatic sync_certs; 609 CertIssuerSourceStatic sync_certs;
620 sync_certs.AddCert(oldintermediate_); 610 sync_certs.AddCert(oldintermediate_);
621 611
622 CertPathBuilder::Result result; 612 CertPathBuilder::Result result;
623 CertPathBuilder path_builder(target_, &trust_store_collection, 613 CertPathBuilder path_builder(target_, &trust_store_collection,
624 &signature_policy_, time_, KeyPurpose::ANY_EKU, 614 &signature_policy_, time_, KeyPurpose::ANY_EKU,
625 &result); 615 &result);
626 path_builder.AddCertIssuerSource(&sync_certs); 616 path_builder.AddCertIssuerSource(&sync_certs);
627 617
628 path_builder.Run(); 618 path_builder.Run();
629 619
630 EXPECT_TRUE(result.HasValidPath()); 620 EXPECT_TRUE(result.HasValidPath());
631 ASSERT_EQ(2U, result.paths.size()); 621 ASSERT_EQ(2U, result.paths.size());
632 622
633 { 623 {
634 // Path builder may first attempt: target <- oldintermediate <- newroot 624 // Path builder may first attempt: target <- oldintermediate <- newroot
635 // but it will fail since oldintermediate is signed by oldroot. 625 // but it will fail since oldintermediate is signed by oldroot.
636 EXPECT_FALSE(result.paths[0]->IsValid()); 626 EXPECT_FALSE(result.paths[0]->IsValid());
637 const auto& path = result.paths[0]->path; 627 const auto& path = result.paths[0]->path;
638 ASSERT_EQ(2U, path.certs.size()); 628 ASSERT_EQ(3U, path.certs.size());
639 EXPECT_EQ(target_, path.certs[0]); 629 EXPECT_EQ(target_, path.certs[0]);
640 EXPECT_EQ(oldintermediate_, path.certs[1]); 630 EXPECT_EQ(oldintermediate_, path.certs[1]);
641 EXPECT_EQ(newroot_, path.trust_anchor->cert()); 631 EXPECT_EQ(newroot_, path.certs[2]);
642 } 632 }
643 633
644 { 634 {
645 // Path builder will next attempt: 635 // Path builder will next attempt:
646 // target <- old intermediate <- oldroot 636 // target <- old intermediate <- oldroot
647 // which should succeed. 637 // which should succeed.
648 EXPECT_TRUE(result.paths[result.best_result_index]->IsValid()); 638 EXPECT_TRUE(result.paths[result.best_result_index]->IsValid());
649 const auto& path = result.paths[result.best_result_index]->path; 639 const auto& path = result.paths[result.best_result_index]->path;
650 ASSERT_EQ(2U, path.certs.size()); 640 ASSERT_EQ(3U, path.certs.size());
651 EXPECT_EQ(target_, path.certs[0]); 641 EXPECT_EQ(target_, path.certs[0]);
652 EXPECT_EQ(oldintermediate_, path.certs[1]); 642 EXPECT_EQ(oldintermediate_, path.certs[1]);
653 EXPECT_EQ(oldroot_, path.trust_anchor); 643 EXPECT_EQ(oldroot_, path.certs[2]);
654 } 644 }
655 } 645 }
656 646
657 // Tests that the path builder doesn't build longer than necessary paths. 647 // Tests that the path builder doesn't build longer than necessary paths.
658 TEST_F(PathBuilderKeyRolloverTest, TestRolloverLongChain) { 648 TEST_F(PathBuilderKeyRolloverTest, TestRolloverLongChain) {
659 // Only oldroot is trusted. 649 // Only oldroot is trusted.
660 TrustStoreInMemory trust_store; 650 TrustStoreInMemory trust_store;
661 trust_store.AddTrustAnchor(oldroot_); 651 trust_store.AddTrustAnchor(oldroot_);
662 652
663 // New intermediate and new root are provided synchronously. 653 // New intermediate and new root are provided synchronously.
(...skipping 14 matching lines...) Expand all
678 668
679 path_builder.Run(); 669 path_builder.Run();
680 670
681 EXPECT_TRUE(result.HasValidPath()); 671 EXPECT_TRUE(result.HasValidPath());
682 ASSERT_EQ(3U, result.paths.size()); 672 ASSERT_EQ(3U, result.paths.size());
683 673
684 // Path builder will first attempt: target <- newintermediate <- oldroot 674 // Path builder will first attempt: target <- newintermediate <- oldroot
685 // but it will fail since newintermediate is signed by newroot. 675 // but it will fail since newintermediate is signed by newroot.
686 EXPECT_FALSE(result.paths[0]->IsValid()); 676 EXPECT_FALSE(result.paths[0]->IsValid());
687 const auto& path0 = result.paths[0]->path; 677 const auto& path0 = result.paths[0]->path;
688 ASSERT_EQ(2U, path0.certs.size()); 678 ASSERT_EQ(3U, path0.certs.size());
689 EXPECT_EQ(target_, path0.certs[0]); 679 EXPECT_EQ(target_, path0.certs[0]);
690 EXPECT_EQ(newintermediate_, path0.certs[1]); 680 EXPECT_EQ(newintermediate_, path0.certs[1]);
691 EXPECT_EQ(oldroot_, path0.trust_anchor); 681 EXPECT_EQ(oldroot_, path0.certs[2]);
692 682
693 // Path builder will next attempt: 683 // Path builder will next attempt:
694 // target <- newintermediate <- newroot <- oldroot 684 // target <- newintermediate <- newroot <- oldroot
695 // but it will fail since newroot is self-signed. 685 // but it will fail since newroot is self-signed.
696 EXPECT_FALSE(result.paths[1]->IsValid()); 686 EXPECT_FALSE(result.paths[1]->IsValid());
697 const auto& path1 = result.paths[1]->path; 687 const auto& path1 = result.paths[1]->path;
698 ASSERT_EQ(3U, path1.certs.size()); 688 ASSERT_EQ(4U, path1.certs.size());
699 EXPECT_EQ(target_, path1.certs[0]); 689 EXPECT_EQ(target_, path1.certs[0]);
700 EXPECT_EQ(newintermediate_, path1.certs[1]); 690 EXPECT_EQ(newintermediate_, path1.certs[1]);
701 EXPECT_EQ(newroot_, path1.certs[2]); 691 EXPECT_EQ(newroot_, path1.certs[2]);
702 EXPECT_EQ(oldroot_, path1.trust_anchor); 692 EXPECT_EQ(oldroot_, path1.certs[3]);
703 693
704 // Path builder will skip: 694 // Path builder will skip:
705 // target <- newintermediate <- newroot <- newrootrollover <- ... 695 // target <- newintermediate <- newroot <- newrootrollover <- ...
706 // Since newroot and newrootrollover have the same Name+SAN+SPKI. 696 // Since newroot and newrootrollover have the same Name+SAN+SPKI.
707 697
708 // Finally path builder will use: 698 // Finally path builder will use:
709 // target <- newintermediate <- newrootrollover <- oldroot 699 // target <- newintermediate <- newrootrollover <- oldroot
710 EXPECT_EQ(2U, result.best_result_index); 700 EXPECT_EQ(2U, result.best_result_index);
711 EXPECT_TRUE(result.paths[2]->IsValid()); 701 EXPECT_TRUE(result.paths[2]->IsValid());
712 const auto& path2 = result.paths[2]->path; 702 const auto& path2 = result.paths[2]->path;
713 ASSERT_EQ(3U, path2.certs.size()); 703 ASSERT_EQ(4U, path2.certs.size());
714 EXPECT_EQ(target_, path2.certs[0]); 704 EXPECT_EQ(target_, path2.certs[0]);
715 EXPECT_EQ(newintermediate_, path2.certs[1]); 705 EXPECT_EQ(newintermediate_, path2.certs[1]);
716 EXPECT_EQ(newrootrollover_, path2.certs[2]); 706 EXPECT_EQ(newrootrollover_, path2.certs[2]);
717 EXPECT_EQ(oldroot_, path2.trust_anchor); 707 EXPECT_EQ(oldroot_, path2.certs[3]);
718 } 708 }
719 709
720 // If the target cert is a trust anchor, however is not itself *signed* by a 710 // If the target cert is a trust anchor, however is not itself *signed* by a
721 // trust anchor, then it is not considered valid (the SPKI and name of the 711 // trust anchor, then it is not considered valid (the SPKI and name of the
722 // trust anchor matches the SPKI and subject of the targe certificate, but the 712 // trust anchor matches the SPKI and subject of the targe certificate, but the
723 // rest of the certificate cannot be verified). 713 // rest of the certificate cannot be verified).
724 TEST_F(PathBuilderKeyRolloverTest, TestEndEntityIsTrustRoot) { 714 TEST_F(PathBuilderKeyRolloverTest, TestEndEntityIsTrustRoot) {
725 // Trust newintermediate. 715 // Trust newintermediate.
726 TrustStoreInMemory trust_store; 716 TrustStoreInMemory trust_store;
727 AddTrustedCertificate(newintermediate_, &trust_store); 717 trust_store.AddTrustAnchor(newintermediate_);
728 718
729 CertPathBuilder::Result result; 719 CertPathBuilder::Result result;
730 // Newintermediate is also the target cert. 720 // Newintermediate is also the target cert.
731 CertPathBuilder path_builder(newintermediate_, &trust_store, 721 CertPathBuilder path_builder(newintermediate_, &trust_store,
732 &signature_policy_, time_, KeyPurpose::ANY_EKU, 722 &signature_policy_, time_, KeyPurpose::ANY_EKU,
733 &result); 723 &result);
734 724
735 path_builder.Run(); 725 path_builder.Run();
736 726
737 EXPECT_FALSE(result.HasValidPath()); 727 EXPECT_FALSE(result.HasValidPath());
(...skipping 25 matching lines...) Expand all
763 // newroot <- newrootrollover <- oldroot path. 753 // newroot <- newrootrollover <- oldroot path.
764 EXPECT_FALSE(result.HasValidPath()); 754 EXPECT_FALSE(result.HasValidPath());
765 } 755 }
766 756
767 // If target has same Name+SAN+SPKI as the trust root, test that a (trivial) 757 // If target has same Name+SAN+SPKI as the trust root, test that a (trivial)
768 // path can still be built. 758 // path can still be built.
769 TEST_F(PathBuilderKeyRolloverTest, 759 TEST_F(PathBuilderKeyRolloverTest,
770 TestEndEntityHasSameNameAndSpkiAsTrustAnchor) { 760 TestEndEntityHasSameNameAndSpkiAsTrustAnchor) {
771 // Trust newrootrollover. 761 // Trust newrootrollover.
772 TrustStoreInMemory trust_store; 762 TrustStoreInMemory trust_store;
773 AddTrustedCertificate(newrootrollover_, &trust_store); 763 trust_store.AddTrustAnchor(newrootrollover_);
774 764
775 CertPathBuilder::Result result; 765 CertPathBuilder::Result result;
776 // Newroot is the target cert. 766 // Newroot is the target cert.
777 CertPathBuilder path_builder(newroot_, &trust_store, &signature_policy_, 767 CertPathBuilder path_builder(newroot_, &trust_store, &signature_policy_,
778 time_, KeyPurpose::ANY_EKU, &result); 768 time_, KeyPurpose::ANY_EKU, &result);
779 769
780 path_builder.Run(); 770 path_builder.Run();
781 771
782 ASSERT_TRUE(result.HasValidPath()); 772 ASSERT_TRUE(result.HasValidPath());
783 773
784 const CertPathBuilder::ResultPath* best_result = result.GetBestValidPath(); 774 const CertPathBuilder::ResultPath* best_result = result.GetBestValidPath();
785 775
786 // Newroot has same name+SPKI as newrootrollover, thus the path is valid and 776 // Newroot has same name+SPKI as newrootrollover, thus the path is valid and
787 // only contains newroot. 777 // only contains newroot.
788 EXPECT_TRUE(best_result->IsValid()); 778 EXPECT_TRUE(best_result->IsValid());
789 ASSERT_EQ(1U, best_result->path.certs.size()); 779 ASSERT_EQ(2U, best_result->path.certs.size());
790 EXPECT_EQ(newroot_, best_result->path.certs[0]); 780 EXPECT_EQ(newroot_, best_result->path.certs[0]);
791 EXPECT_EQ(newrootrollover_, best_result->path.trust_anchor->cert()); 781 EXPECT_EQ(newrootrollover_, best_result->path.certs[1]);
792 } 782 }
793 783
794 // Test that PathBuilder will not try the same path twice if multiple 784 // Test that PathBuilder will not try the same path twice if multiple
795 // CertIssuerSources provide the same certificate. 785 // CertIssuerSources provide the same certificate.
796 TEST_F(PathBuilderKeyRolloverTest, TestDuplicateIntermediates) { 786 TEST_F(PathBuilderKeyRolloverTest, TestDuplicateIntermediates) {
797 // Create a separate copy of oldintermediate. 787 // Create a separate copy of oldintermediate.
798 scoped_refptr<ParsedCertificate> oldintermediate_dupe( 788 scoped_refptr<ParsedCertificate> oldintermediate_dupe(
799 ParsedCertificate::Create( 789 ParsedCertificate::Create(
800 bssl::UniquePtr<CRYPTO_BUFFER>(CRYPTO_BUFFER_new( 790 bssl::UniquePtr<CRYPTO_BUFFER>(CRYPTO_BUFFER_new(
801 oldintermediate_->der_cert().UnsafeData(), 791 oldintermediate_->der_cert().UnsafeData(),
802 oldintermediate_->der_cert().Length(), nullptr)), 792 oldintermediate_->der_cert().Length(), nullptr)),
803 {}, nullptr)); 793 {}, nullptr));
804 794
805 // Only newroot is a trusted root. 795 // Only newroot is a trusted root.
806 TrustStoreInMemory trust_store; 796 TrustStoreInMemory trust_store;
807 AddTrustedCertificate(newroot_, &trust_store); 797 trust_store.AddTrustAnchor(newroot_);
808 798
809 // The oldintermediate is supplied synchronously by |sync_certs1| and 799 // The oldintermediate is supplied synchronously by |sync_certs1| and
810 // another copy of oldintermediate is supplied synchronously by |sync_certs2|. 800 // another copy of oldintermediate is supplied synchronously by |sync_certs2|.
811 // The path target <- oldintermediate <- newroot should be built first, 801 // The path target <- oldintermediate <- newroot should be built first,
812 // though it won't verify. It should not be attempted again even though 802 // though it won't verify. It should not be attempted again even though
813 // oldintermediate was supplied twice. 803 // oldintermediate was supplied twice.
814 CertIssuerSourceStatic sync_certs1; 804 CertIssuerSourceStatic sync_certs1;
815 sync_certs1.AddCert(oldintermediate_); 805 sync_certs1.AddCert(oldintermediate_);
816 CertIssuerSourceStatic sync_certs2; 806 CertIssuerSourceStatic sync_certs2;
817 sync_certs2.AddCert(oldintermediate_dupe); 807 sync_certs2.AddCert(oldintermediate_dupe);
(...skipping 13 matching lines...) Expand all
831 path_builder.Run(); 821 path_builder.Run();
832 822
833 EXPECT_TRUE(result.HasValidPath()); 823 EXPECT_TRUE(result.HasValidPath());
834 ASSERT_EQ(2U, result.paths.size()); 824 ASSERT_EQ(2U, result.paths.size());
835 825
836 // Path builder will first attempt: target <- oldintermediate <- newroot 826 // Path builder will first attempt: target <- oldintermediate <- newroot
837 // but it will fail since oldintermediate is signed by oldroot. 827 // but it will fail since oldintermediate is signed by oldroot.
838 EXPECT_FALSE(result.paths[0]->IsValid()); 828 EXPECT_FALSE(result.paths[0]->IsValid());
839 const auto& path0 = result.paths[0]->path; 829 const auto& path0 = result.paths[0]->path;
840 830
841 ASSERT_EQ(2U, path0.certs.size()); 831 ASSERT_EQ(3U, path0.certs.size());
842 EXPECT_EQ(target_, path0.certs[0]); 832 EXPECT_EQ(target_, path0.certs[0]);
843 // Compare the DER instead of ParsedCertificate pointer, don't care which copy 833 // Compare the DER instead of ParsedCertificate pointer, don't care which copy
844 // of oldintermediate was used in the path. 834 // of oldintermediate was used in the path.
845 EXPECT_EQ(oldintermediate_->der_cert(), path0.certs[1]->der_cert()); 835 EXPECT_EQ(oldintermediate_->der_cert(), path0.certs[1]->der_cert());
846 EXPECT_EQ(newroot_, path0.trust_anchor->cert()); 836 EXPECT_EQ(newroot_, path0.certs[2]);
847 837
848 // Path builder will next attempt: target <- newintermediate <- newroot 838 // Path builder will next attempt: target <- newintermediate <- newroot
849 // which will succeed. 839 // which will succeed.
850 EXPECT_EQ(1U, result.best_result_index); 840 EXPECT_EQ(1U, result.best_result_index);
851 EXPECT_TRUE(result.paths[1]->IsValid()); 841 EXPECT_TRUE(result.paths[1]->IsValid());
852 const auto& path1 = result.paths[1]->path; 842 const auto& path1 = result.paths[1]->path;
853 ASSERT_EQ(2U, path1.certs.size()); 843 ASSERT_EQ(3U, path1.certs.size());
854 EXPECT_EQ(target_, path1.certs[0]); 844 EXPECT_EQ(target_, path1.certs[0]);
855 EXPECT_EQ(newintermediate_, path1.certs[1]); 845 EXPECT_EQ(newintermediate_, path1.certs[1]);
856 EXPECT_EQ(newroot_, path1.trust_anchor->cert()); 846 EXPECT_EQ(newroot_, path1.certs[2]);
857 } 847 }
858 848
859 // Test when PathBuilder is given a cert CertIssuerSources that has the same 849 // Test when PathBuilder is given a cert via CertIssuerSources that has the same
860 // SPKI as a TrustAnchor. 850 // SPKI as a trust anchor.
861 TEST_F(PathBuilderKeyRolloverTest, TestDuplicateIntermediateAndRoot) { 851 TEST_F(PathBuilderKeyRolloverTest, TestDuplicateIntermediateAndRoot) {
862 // Create a separate copy of newroot. 852 // Create a separate copy of newroot.
863 scoped_refptr<ParsedCertificate> newroot_dupe(ParsedCertificate::Create( 853 scoped_refptr<ParsedCertificate> newroot_dupe(ParsedCertificate::Create(
864 bssl::UniquePtr<CRYPTO_BUFFER>( 854 bssl::UniquePtr<CRYPTO_BUFFER>(
865 CRYPTO_BUFFER_new(newroot_->der_cert().UnsafeData(), 855 CRYPTO_BUFFER_new(newroot_->der_cert().UnsafeData(),
866 newroot_->der_cert().Length(), nullptr)), 856 newroot_->der_cert().Length(), nullptr)),
867 {}, nullptr)); 857 {}, nullptr));
868 858
869 // Only newroot is a trusted root. 859 // Only newroot is a trusted root.
870 TrustStoreInMemory trust_store; 860 TrustStoreInMemory trust_store;
871 AddTrustedCertificate(newroot_, &trust_store); 861 trust_store.AddTrustAnchor(newroot_);
872 862
873 // The oldintermediate and newroot are supplied synchronously by |sync_certs|. 863 // The oldintermediate and newroot are supplied synchronously by |sync_certs|.
874 CertIssuerSourceStatic sync_certs; 864 CertIssuerSourceStatic sync_certs;
875 sync_certs.AddCert(oldintermediate_); 865 sync_certs.AddCert(oldintermediate_);
876 sync_certs.AddCert(newroot_dupe); 866 sync_certs.AddCert(newroot_dupe);
877 867
878 CertPathBuilder::Result result; 868 CertPathBuilder::Result result;
879 CertPathBuilder path_builder(target_, &trust_store, &signature_policy_, time_, 869 CertPathBuilder path_builder(target_, &trust_store, &signature_policy_, time_,
880 KeyPurpose::ANY_EKU, &result); 870 KeyPurpose::ANY_EKU, &result);
881 path_builder.AddCertIssuerSource(&sync_certs); 871 path_builder.AddCertIssuerSource(&sync_certs);
882 872
883 path_builder.Run(); 873 path_builder.Run();
884 874
885 EXPECT_FALSE(result.HasValidPath()); 875 EXPECT_FALSE(result.HasValidPath());
886 ASSERT_EQ(2U, result.paths.size()); 876 ASSERT_EQ(1U, result.paths.size());
887 // TODO(eroman): Is this right?
888 877
889 // Path builder attempt: target <- oldintermediate <- newroot 878 // Path builder attempt: target <- oldintermediate <- newroot
890 // but it will fail since oldintermediate is signed by oldroot. 879 // but it will fail since oldintermediate is signed by oldroot.
891 EXPECT_FALSE(result.paths[0]->IsValid()); 880 EXPECT_FALSE(result.paths[0]->IsValid());
892 const auto& path = result.paths[0]->path; 881 const auto& path = result.paths[0]->path;
893 ASSERT_EQ(2U, path.certs.size()); 882 ASSERT_EQ(3U, path.certs.size());
894 EXPECT_EQ(target_, path.certs[0]); 883 EXPECT_EQ(target_, path.certs[0]);
895 EXPECT_EQ(oldintermediate_, path.certs[1]); 884 EXPECT_EQ(oldintermediate_, path.certs[1]);
896 // Compare the DER instead of ParsedCertificate pointer, don't care which copy 885 // Compare the DER instead of ParsedCertificate pointer, don't care which copy
897 // of newroot was used in the path. 886 // of newroot was used in the path.
898 EXPECT_EQ(newroot_->der_cert(), path.trust_anchor->cert()->der_cert()); 887 EXPECT_EQ(newroot_->der_cert(), path.certs[2]->der_cert());
899 } 888 }
900 889
901 class MockCertIssuerSourceRequest : public CertIssuerSource::Request { 890 class MockCertIssuerSourceRequest : public CertIssuerSource::Request {
902 public: 891 public:
903 MOCK_METHOD1(GetNext, void(ParsedCertificateList*)); 892 MOCK_METHOD1(GetNext, void(ParsedCertificateList*));
904 }; 893 };
905 894
906 class MockCertIssuerSource : public CertIssuerSource { 895 class MockCertIssuerSource : public CertIssuerSource {
907 public: 896 public:
908 MOCK_METHOD2(SyncGetIssuersOf, 897 MOCK_METHOD2(SyncGetIssuersOf,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 }; 930 };
942 931
943 // Test that a single CertIssuerSource returning multiple async batches of 932 // Test that a single CertIssuerSource returning multiple async batches of
944 // issuers is handled correctly. Due to the StrictMocks, it also tests that path 933 // issuers is handled correctly. Due to the StrictMocks, it also tests that path
945 // builder does not request issuers of certs that it shouldn't. 934 // builder does not request issuers of certs that it shouldn't.
946 TEST_F(PathBuilderKeyRolloverTest, TestMultipleAsyncIssuersFromSingleSource) { 935 TEST_F(PathBuilderKeyRolloverTest, TestMultipleAsyncIssuersFromSingleSource) {
947 StrictMock<MockCertIssuerSource> cert_issuer_source; 936 StrictMock<MockCertIssuerSource> cert_issuer_source;
948 937
949 // Only newroot is a trusted root. 938 // Only newroot is a trusted root.
950 TrustStoreInMemory trust_store; 939 TrustStoreInMemory trust_store;
951 AddTrustedCertificate(newroot_, &trust_store); 940 trust_store.AddTrustAnchor(newroot_);
952 941
953 CertPathBuilder::Result result; 942 CertPathBuilder::Result result;
954 CertPathBuilder path_builder(target_, &trust_store, &signature_policy_, time_, 943 CertPathBuilder path_builder(target_, &trust_store, &signature_policy_, time_,
955 KeyPurpose::ANY_EKU, &result); 944 KeyPurpose::ANY_EKU, &result);
956 path_builder.AddCertIssuerSource(&cert_issuer_source); 945 path_builder.AddCertIssuerSource(&cert_issuer_source);
957 946
958 // Create the mock CertIssuerSource::Request... 947 // Create the mock CertIssuerSource::Request...
959 std::unique_ptr<StrictMock<MockCertIssuerSourceRequest>> 948 std::unique_ptr<StrictMock<MockCertIssuerSourceRequest>>
960 target_issuers_req_owner(new StrictMock<MockCertIssuerSourceRequest>()); 949 target_issuers_req_owner(new StrictMock<MockCertIssuerSourceRequest>());
961 // Keep a raw pointer to the Request... 950 // Keep a raw pointer to the Request...
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 // expectations get checked by the destructor. 987 // expectations get checked by the destructor.
999 ::testing::Mock::VerifyAndClearExpectations(&cert_issuer_source); 988 ::testing::Mock::VerifyAndClearExpectations(&cert_issuer_source);
1000 989
1001 EXPECT_TRUE(result.HasValidPath()); 990 EXPECT_TRUE(result.HasValidPath());
1002 ASSERT_EQ(2U, result.paths.size()); 991 ASSERT_EQ(2U, result.paths.size());
1003 992
1004 // Path builder first attempts: target <- oldintermediate <- newroot 993 // Path builder first attempts: target <- oldintermediate <- newroot
1005 // but it will fail since oldintermediate is signed by oldroot. 994 // but it will fail since oldintermediate is signed by oldroot.
1006 EXPECT_FALSE(result.paths[0]->IsValid()); 995 EXPECT_FALSE(result.paths[0]->IsValid());
1007 const auto& path0 = result.paths[0]->path; 996 const auto& path0 = result.paths[0]->path;
1008 ASSERT_EQ(2U, path0.certs.size()); 997 ASSERT_EQ(3U, path0.certs.size());
1009 EXPECT_EQ(target_, path0.certs[0]); 998 EXPECT_EQ(target_, path0.certs[0]);
1010 EXPECT_EQ(oldintermediate_, path0.certs[1]); 999 EXPECT_EQ(oldintermediate_, path0.certs[1]);
1011 EXPECT_EQ(newroot_, path0.trust_anchor->cert()); 1000 EXPECT_EQ(newroot_, path0.certs[2]);
1012 1001
1013 // After the second batch of async results, path builder will attempt: 1002 // After the second batch of async results, path builder will attempt:
1014 // target <- newintermediate <- newroot which will succeed. 1003 // target <- newintermediate <- newroot which will succeed.
1015 EXPECT_TRUE(result.paths[1]->IsValid()); 1004 EXPECT_TRUE(result.paths[1]->IsValid());
1016 const auto& path1 = result.paths[1]->path; 1005 const auto& path1 = result.paths[1]->path;
1017 ASSERT_EQ(2U, path1.certs.size()); 1006 ASSERT_EQ(3U, path1.certs.size());
1018 EXPECT_EQ(target_, path1.certs[0]); 1007 EXPECT_EQ(target_, path1.certs[0]);
1019 EXPECT_EQ(newintermediate_, path1.certs[1]); 1008 EXPECT_EQ(newintermediate_, path1.certs[1]);
1020 EXPECT_EQ(newroot_, path1.trust_anchor->cert()); 1009 EXPECT_EQ(newroot_, path1.certs[2]);
1021 } 1010 }
1022 1011
1023 // Test that PathBuilder will not try the same path twice if CertIssuerSources 1012 // Test that PathBuilder will not try the same path twice if CertIssuerSources
1024 // asynchronously provide the same certificate multiple times. 1013 // asynchronously provide the same certificate multiple times.
1025 TEST_F(PathBuilderKeyRolloverTest, TestDuplicateAsyncIntermediates) { 1014 TEST_F(PathBuilderKeyRolloverTest, TestDuplicateAsyncIntermediates) {
1026 StrictMock<MockCertIssuerSource> cert_issuer_source; 1015 StrictMock<MockCertIssuerSource> cert_issuer_source;
1027 1016
1028 // Only newroot is a trusted root. 1017 // Only newroot is a trusted root.
1029 TrustStoreInMemory trust_store; 1018 TrustStoreInMemory trust_store;
1030 AddTrustedCertificate(newroot_, &trust_store); 1019 trust_store.AddTrustAnchor(newroot_);
1031 1020
1032 CertPathBuilder::Result result; 1021 CertPathBuilder::Result result;
1033 CertPathBuilder path_builder(target_, &trust_store, &signature_policy_, time_, 1022 CertPathBuilder path_builder(target_, &trust_store, &signature_policy_, time_,
1034 KeyPurpose::ANY_EKU, &result); 1023 KeyPurpose::ANY_EKU, &result);
1035 path_builder.AddCertIssuerSource(&cert_issuer_source); 1024 path_builder.AddCertIssuerSource(&cert_issuer_source);
1036 1025
1037 // Create the mock CertIssuerSource::Request... 1026 // Create the mock CertIssuerSource::Request...
1038 std::unique_ptr<StrictMock<MockCertIssuerSourceRequest>> 1027 std::unique_ptr<StrictMock<MockCertIssuerSourceRequest>>
1039 target_issuers_req_owner(new StrictMock<MockCertIssuerSourceRequest>()); 1028 target_issuers_req_owner(new StrictMock<MockCertIssuerSourceRequest>());
1040 // Keep a raw pointer to the Request... 1029 // Keep a raw pointer to the Request...
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1084 1073
1085 ::testing::Mock::VerifyAndClearExpectations(&cert_issuer_source); 1074 ::testing::Mock::VerifyAndClearExpectations(&cert_issuer_source);
1086 1075
1087 EXPECT_TRUE(result.HasValidPath()); 1076 EXPECT_TRUE(result.HasValidPath());
1088 ASSERT_EQ(2U, result.paths.size()); 1077 ASSERT_EQ(2U, result.paths.size());
1089 1078
1090 // Path builder first attempts: target <- oldintermediate <- newroot 1079 // Path builder first attempts: target <- oldintermediate <- newroot
1091 // but it will fail since oldintermediate is signed by oldroot. 1080 // but it will fail since oldintermediate is signed by oldroot.
1092 EXPECT_FALSE(result.paths[0]->IsValid()); 1081 EXPECT_FALSE(result.paths[0]->IsValid());
1093 const auto& path0 = result.paths[0]->path; 1082 const auto& path0 = result.paths[0]->path;
1094 ASSERT_EQ(2U, path0.certs.size()); 1083 ASSERT_EQ(3U, path0.certs.size());
1095 EXPECT_EQ(target_, path0.certs[0]); 1084 EXPECT_EQ(target_, path0.certs[0]);
1096 EXPECT_EQ(oldintermediate_, path0.certs[1]); 1085 EXPECT_EQ(oldintermediate_, path0.certs[1]);
1097 EXPECT_EQ(newroot_, path0.trust_anchor->cert()); 1086 EXPECT_EQ(newroot_, path0.certs[2]);
1098 1087
1099 // The second async result does not generate any path. 1088 // The second async result does not generate any path.
1100 1089
1101 // After the third batch of async results, path builder will attempt: 1090 // After the third batch of async results, path builder will attempt:
1102 // target <- newintermediate <- newroot which will succeed. 1091 // target <- newintermediate <- newroot which will succeed.
1103 EXPECT_TRUE(result.paths[1]->IsValid()); 1092 EXPECT_TRUE(result.paths[1]->IsValid());
1104 const auto& path1 = result.paths[1]->path; 1093 const auto& path1 = result.paths[1]->path;
1105 ASSERT_EQ(2U, path1.certs.size()); 1094 ASSERT_EQ(3U, path1.certs.size());
1106 EXPECT_EQ(target_, path1.certs[0]); 1095 EXPECT_EQ(target_, path1.certs[0]);
1107 EXPECT_EQ(newintermediate_, path1.certs[1]); 1096 EXPECT_EQ(newintermediate_, path1.certs[1]);
1108 EXPECT_EQ(newroot_, path1.trust_anchor->cert()); 1097 EXPECT_EQ(newroot_, path1.certs[2]);
1109 } 1098 }
1110 1099
1111 } // namespace 1100 } // namespace
1112 1101
1113 } // namespace net 1102 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698