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

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

Issue 2903633005: Add generated PKITS tests relating to certificate policies. (Closed)
Patch Set: Update comments Created 3 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
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "net/cert/internal/nist_pkits_unittest.h"
6
7 #include "base/strings/string_split.h"
8 #include "net/cert/internal/certificate_policies.h"
9
10 namespace net {
11
12 namespace {
13
14 // 2.16.840.1.101.3.2.1.48.1
15 const uint8_t kTestPolicy1[] = {0x60, 0x86, 0x48, 0x01, 0x65,
16 0x03, 0x02, 0x01, 0x30, 0x01};
17
18 // 2.16.840.1.101.3.2.1.48.2
19 const uint8_t kTestPolicy2[] = {0x60, 0x86, 0x48, 0x01, 0x65,
20 0x03, 0x02, 0x01, 0x30, 0x02};
21
22 // 2.16.840.1.101.3.2.1.48.3
23 const uint8_t kTestPolicy3[] = {0x60, 0x86, 0x48, 0x01, 0x65,
24 0x03, 0x02, 0x01, 0x30, 0x03};
25
26 // 2.16.840.1.101.3.2.1.48.6
27 const uint8_t kTestPolicy6[] = {0x60, 0x86, 0x48, 0x01, 0x65,
28 0x03, 0x02, 0x01, 0x30, 0x06};
29
30 } // namespace
31
32 PkitsTestSettings::PkitsTestSettings() {
33 SetInitialPolicySet("anyPolicy");
34 }
35
36 PkitsTestSettings::~PkitsTestSettings() = default;
37
38 void PkitsTestSettings::SetInitialPolicySet(const char* const policy_names) {
39 initial_policy_set.clear();
40 std::vector<std::string> names = base::SplitString(
41 policy_names, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
42 for (const std::string& policy_name : names) {
43 if (policy_name == "anyPolicy") {
44 initial_policy_set.insert(AnyPolicy());
45 } else if (policy_name == "NIST-test-policy-1") {
46 initial_policy_set.insert(der::Input(kTestPolicy1));
47 } else if (policy_name == "NIST-test-policy-2") {
48 initial_policy_set.insert(der::Input(kTestPolicy2));
49 } else if (policy_name == "NIST-test-policy-3") {
50 initial_policy_set.insert(der::Input(kTestPolicy3));
51 } else if (policy_name == "NIST-test-policy-6") {
52 initial_policy_set.insert(der::Input(kTestPolicy6));
53 } else {
54 ADD_FAILURE() << "Unknown policy name: " << policy_name;
55 }
56 }
57 }
58
59 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/internal/nist_pkits_unittest.h ('k') | net/cert/internal/path_builder_pkits_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698