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

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

Issue 2093223002: Allow Cast certificates to have serial numbers greater than 20 bytes, as well as non-minimal INTEGE… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 6 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
« no previous file with comments | « net/cert/internal/verify_certificate_chain_pkits_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 bool expected_result; 100 bool expected_result;
101 101
102 ReadTestFromFile(file_name, &chain, &trust_store, &time, &expected_result); 102 ReadTestFromFile(file_name, &chain, &trust_store, &time, &expected_result);
103 103
104 std::vector<der::Input> input_chain; 104 std::vector<der::Input> input_chain;
105 for (const auto& cert_str : chain) 105 for (const auto& cert_str : chain)
106 input_chain.push_back(der::Input(&cert_str)); 106 input_chain.push_back(der::Input(&cert_str));
107 107
108 SimpleSignaturePolicy signature_policy(1024); 108 SimpleSignaturePolicy signature_policy(1024);
109 109
110 bool result = 110 bool result = VerifyCertificateChain(input_chain, {}, trust_store,
111 VerifyCertificateChain(input_chain, trust_store, &signature_policy, time); 111 &signature_policy, time);
112 112
113 ASSERT_EQ(expected_result, result); 113 ASSERT_EQ(expected_result, result);
114 } 114 }
115 115
116 TEST(VerifyCertificateChainTest, TargetAndIntermediary) { 116 TEST(VerifyCertificateChainTest, TargetAndIntermediary) {
117 RunTest("target-and-intermediary.pem"); 117 RunTest("target-and-intermediary.pem");
118 } 118 }
119 119
120 TEST(VerifyCertificateChainTest, UnknownRoot) { 120 TEST(VerifyCertificateChainTest, UnknownRoot) {
121 RunTest("unknown-root.pem"); 121 RunTest("unknown-root.pem");
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 } 222 }
223 223
224 // Tests that verifying a chain with no certificates fails. 224 // Tests that verifying a chain with no certificates fails.
225 TEST(VerifyCertificateChainTest, EmptyChainIsInvalid) { 225 TEST(VerifyCertificateChainTest, EmptyChainIsInvalid) {
226 TrustStore trust_store; 226 TrustStore trust_store;
227 der::GeneralizedTime time; 227 der::GeneralizedTime time;
228 std::vector<der::Input> chain; 228 std::vector<der::Input> chain;
229 SimpleSignaturePolicy signature_policy(2048); 229 SimpleSignaturePolicy signature_policy(2048);
230 230
231 ASSERT_FALSE( 231 ASSERT_FALSE(
232 VerifyCertificateChain(chain, trust_store, &signature_policy, time)); 232 VerifyCertificateChain(chain, {}, trust_store, &signature_policy, time));
233 } 233 }
234 234
235 // 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
236 // ordinal not in range, like "March 39, 2016" are rejected. 236 // ordinal not in range, like "March 39, 2016" are rejected.
237 237
238 } // namespace 238 } // namespace
239 239
240 } // namespace net 240 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/internal/verify_certificate_chain_pkits_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698